>From a mathematical standpoint in your example, going back to grade 4 math
(35 years ago for me. *sigh*.  I'm so sad....), where clause works based
off of standard order of operations based on BEDMAS and eventually working
things down to booleans.  In your example, the math would be processed as
3+5*4+3
3+20+3
23+3
26

BEDMAS doesn't cover boolean logic, however, so FYI 'AND' is grouped as one
thing and 'OR' is grouped as another.

So:
 WHERE A = 1 AND B = 2 OR C = 3
evaluates differently to
 WHERE A = 1 OR B = 2 AND C = 3

In the first case, A and B have to meet the conditions, or C has to meet
the conditions.
In the second case, A has to meet the condition or B and C has to meet the
conditions.

I've never tried or needed XOR or NAND or any other type of evaluator so I
don't know if SQLite is aware of the other types of boolean algebra.


Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
> Gesendet: Montag, 10. November 2014 10:40
> An: General Discussion of SQLite Database
> Betreff: [sqlite] SQLite where clause tree
>
> The where clause in sqlite is encoded as a tree
>
> Let's say I have select statement like :
>
> SELECT * from employee where salary = 3+5*4+3;
>
> The tree which takes care of operator precedence is :
>
>                            =
>                          /    \
>               salary        +
>                              /   \
>                            3     3
>                           /
>                          *
>                       /    \
>                      5     4
>
> If I am constructing this tree for where clause by myself, should i take
> the operator precedence in to account while constructing it or will sqlite
> take care of precedence,given any tree (i.e constructing it with out taking
> precedence into account) ?
>
> Kindly give me some pointers towards this tree construction Thanks a lot
> for your time.
>
> Regards
> Prakash
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___________________________________________
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: h...@scigames.at
>
> This communication (including any attachments) is intended for the use of
> the intended recipient(s) only and may contain information that is
> confidential, privileged or legally protected. Any unauthorized use or
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please immediately notify the sender
> by return e-mail message and delete all copies of the original
> communication. Thank you for your cooperation.
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to