Difference between OR , AND with where in mysql -
i'm learning mysql
but felt confused after examples below :
select * `users` username = 'admin' or true; here returned rows in users table !
(username = 'admin' or true ) should true ? true
but in example :
select * `users` username = 'admin' , true; it returned 1 row (where username = 'admin')
but (username = 'admin' , true) should true !
so what's difference?
-- true 1 -- true rows username admin username = 'admin' now check truth table:
x y | x , y | x or y ----------------------- f f | f | f f t | f | t t f | f | t t t | t | t https://en.wikipedia.org/wiki/boolean_algebra
if take
xwhere username = 'admin',ywhere 1
you should understand results.
Comments
Post a Comment