select sname as 姓名,sex as 性别
from studentcard
where sdept like '[^信息系,数学系,软件工程系]%'
--------------------------------------------
select sname as 姓名,sex as 性别
from studentcard
where sdept not in ('信息系','数学系','软件工程系')
--------------------------------------------------
select sname as 姓名, sex as 性别
from studentcard
where not sdept ='信息系'and not sdept ='数学系'and not sdept ='软件工程系'
-------------------------------------------------------------------------
select sname as 姓名, sex as 性别
from stedextcard
where sdept <>'信息系'and sdept<>'数学系'and sdept <>'软件工程系'有一张表~名为studentcard~要求是查询不在信息系,数学系,和软件工程系的同学的姓名和性别~为什么第1种与2,3,4种查询的结果不同呢?
from studentcard
where sdept like '[^信息系,数学系,软件工程系]%'
--------------------------------------------
select sname as 姓名,sex as 性别
from studentcard
where sdept not in ('信息系','数学系','软件工程系')
--------------------------------------------------
select sname as 姓名, sex as 性别
from studentcard
where not sdept ='信息系'and not sdept ='数学系'and not sdept ='软件工程系'
-------------------------------------------------------------------------
select sname as 姓名, sex as 性别
from stedextcard
where sdept <>'信息系'and sdept<>'数学系'and sdept <>'软件工程系'有一张表~名为studentcard~要求是查询不在信息系,数学系,和软件工程系的同学的姓名和性别~为什么第1种与2,3,4种查询的结果不同呢?
sdept not in ('信息系','数学系','软件工程系') 只有这三个会被屏蔽掉
查询分析器找一下帮助!看一下
用NOT LIKE '信息系%' AND NOT LIKE '数学系%' AND NOT LIKE '软件工程系%' 看看