On Sun, 22 Dec 2013 05:35:55 +0200
RSmith <rsm...@rsweb.co.za> wrote:

> Similarly any attribute can be Boolean if it is found to be an
> attribute of an object. Giuseppe is not Boolean, but he is human and
> likely male, so that: (Giuseppe = Human) is true or 1, and
> (Giuseppe = Female) is false or 0.
> 
> For RDBMS and indeed most programming languages, any Boolean
> evaluated result can directly be inferred as the arithmetic values 0
> and 1 so that I could make some programmatic assumptive statements
> based

Yes, it's a bit of a trick.  

Boolean logic operates on true and false values.  Any two distinct
symbols can be used.  It so happens SQLite apparently uses
1 and 0, but e.g. -1 and 0 or 'T' and 'F' would serve as well.  

> stats.quantity * (stats.which_month = 1)

is *logically* nonsensical: the product of a numerical quantity and a
a logical one.  What would, say, "7 times false" mean?  

        "false false false false false false false"?  

I'm not sure SQLite necessarily evaluates "x = y" as 0 or 1 for all
compilers and all architectures.  If it does, if SQLite is *defined* to
use 1 and 0 to represent true and false, and the SQL author is
indifferent to issues of portability (and, arguably, obscurity) then
the "number * boolean" construction might be attractive.  It is
certainly more compact.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to