> Quick, without trying it out, what would you expect the following statement > to return: > select 1 where 1 - 1; > (a) one row > (b) no row > (c) syntax error > For extra entertainment, try some variations: > select 1 where 1; > select 1 where 0; > etc... > Bonus points for a rationalization of any of the behaviors you see or don’t > see.
I'm not sure why this is surprising. sqlite happily uses 1 and 0 as booleans: sqlite> select 1 = 1; 1 sqlite> select 1 = 100; 0 And the WHERE clause is just a boolean expression. Your expressions are simply "select the literal 1 where true" or "where false" which will either cause the value to be selected or not, just due to the WHERE clause. Am I missing something?
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users