select *
from authors
where first_name like '%_e%' and gender='M' or not author_id>=16问下,这句sql的执行顺序是怎么样的,主要是where后面的执行顺序,and跟or混在一起的时候,如何执行?
from authors
where first_name like '%_e%' and gender='M' or not author_id>=16问下,这句sql的执行顺序是怎么样的,主要是where后面的执行顺序,and跟or混在一起的时候,如何执行?
where (first_name like '%_e%' and gender='M') or not author_id>=16
from authors
where (first_name like '%_e%' and gender='M') or author_id<16select *
from authors
where first_name like '%_e%' and (gender='M' or author_id<16)
and的优先级比or要高,所以先执行and再执行or
相当于SQL codeselect *
from authors
where (first_name like '%_e%' and gender='M') or not author_id>=16