「e」が姓または姓の4番目の文字で、仮名を持つ著者をリストします。SQL。列に値がない場合は行を表示しない
select * from authors where last_name like '___e%' or first_name like '___e%' and pseudonym is not null and pseudonym <> ' ';
The output still show the row where pseudonym are null (picture)
「e」が姓または姓の4番目の文字で、仮名を持つ著者をリストします。SQL。列に値がない場合は行を表示しない
select * from authors where last_name like '___e%' or first_name like '___e%' and pseudonym is not null and pseudonym <> ' ';
The output still show the row where pseudonym are null (picture)
かっこ必要があります:あなたはSQLを学習している場合は、あなたの条件は、(例えば)AND
(のように複数の論理演算子を持っている時はいつでも、その後に括弧を使用し、
select *
from authors
where (last_name like '___e%' or first_name like '___e%') and
pseudonym is not null and
pseudonym <> ' ';
をし、 (OR
))。
比較is not null
は冗長です。とにかく条件を明示するために、あなたはそれをそのまま残すことをお勧めします。
select *
from authors
where (last_name like '___e%' or first_name like '___e%') and
trim(pseudonym) is not null;