MySQL问题,谢谢


1) . select * from demo where id<=10 and name='zhangsan' and (sex='0' or 'age'>=18);

2).select * from demo where id<=10 and name='zhangsan' and sex='0' or 'age'>=18;

3).select * from demo where id<=10 and name='zhangsan' and sex='0' and 'age'>=18;

4). select * from demo where id<=10 and name='zhangsan' and (sex='0' and 'age'>=18);

我弄不清楚 1和2的区别 3和4的区别,谢谢大神,能指点下吗?

数据库 mysql postgresq oracle sql

cgbugs 10 years, 4 months ago

如楼上所说的,由于括号的问题,执行where字句的顺序也不同了,可能会影响效率

Nemo夜愿 answered 10 years, 4 months ago

Irony_A answered 10 years, 4 months ago

Your Answer