2017-09-14 77 views

回答

1

您需要括號:

select * 
from authors 
where (last_name like '___e%' or first_name like '___e%') and 
     pseudonym is not null and 
     pseudonym <> ' '; 

如果你正在學習SQL,然後使用時,您的情況有一個以上的邏輯運算符括號(如(AND)和(OR))。

比較is not null是多餘的。無論如何,我建議你放棄它,只是爲了明確條件。

2
select * 
from authors 
where (last_name like '___e%' or first_name like '___e%') and 
     trim(pseudonym) is not null; 
相關問題