WHERE name LIKE 'A%' -- any name begins with A
WHERE name LIKE 'A_' -- same, but only 2 letters
WHERE grade >= 80 AND grade <=90;
WHERE grade BETWEEN 80 AND 90;
WHERE grade BETWEEN 80 AND 90 AND class = 1;
WHERE grade BETWEEN 80 AND 90 AND
(class = 1 or class = 2);
WHERE grade BETWEEN 80 AND 90 AND
(class IN (1,2));
and, or, not<, <=, >, >=, =, <>like, ilike (不区分大小写)between .. and ..is null, is not null= 是精确匹配运算符,只有当字段的值完全等于右侧字符串时才为真。LIKE 是模式匹配运算符,支持使用通配符:
% 表示任意长度(包括 0)的任意字符序列_ 表示任意单个字符null is unknownwhere is false if it evaluates to unknow
where name not in (merrick, jack)
select name from instructor
where salary>some(select salary from instructor where dept_name = 'biology')
=some() 和 in() 是等价的
≠all 和 not in 是等价的