包含查询: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'广州');

posted @ 2026-04-27 09:45  菜鸟的奋斗军  阅读(10)  评论(0)    收藏  举报