>>>>> Simon Slavin writes:
>>>>> On 9 Oct 2011, at 3:57am, 张一帆 wrote:

 >> i have some data like "a and b or c ...",there will be a word 'and'
 >> or 'or' which means the Logical relations between each item.

 > If you have "a and b or c" does that mean

 > (a and b) or c    OR
 > a and (b or c)    ?

 > How does your software know ?

        The boolean AND and OR operations are often compared to the
        usual arithmetics' × and +.  Therefore, a AND b OR c is akin to
        a × b + c, and the precedence rules (borrowed from arithmetics)
        will make that (a × b) + c.

        And SQLite, among many others, behaves just like that:

$ sqlite3 :memory: 'SELECT 0 AND  1 OR 1' 
1
$ sqlite3 :memory: 'SELECT 0 AND (1 OR 1)' 
0
$ 

        I guess that it just follows the standard.

-- 
FSF associate member #7257

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

Reply via email to