包含查询:IN、NOT IN
create table studentfd
(
stu_name nvarchar(20),
age int,
city nvarchar(20)
);
--插入测试数据
insert into studentfd
values
(N'张三',18,N'北京'),
(N'李四',20,N'上海'),
(N'王五',19,'广州'),
(N'赵六',18,N'深圳');
select *
from studentfd
where age in (18,20); --匹配多个固定值
select *
from student
where age not in(18,19); --排除多个固定值
select *
from studentfd
where city in(N'北京',N'广州');

浙公网安备 33010602011771号