use mydb
select *from Category where Parent='013' or parent='011' or Parent='012'
--in 代表在某些参数范围之内的都符合条件,相当于多个or
select *from Category where Parent in('013','011','012')
--not 起修饰作用,取反
select *from Category where Parent not in ('013','011','012')
--between and 表示在某范围之内,相当于>= <=
select *from Category where Ids>500 and Ids<505
select *from Category where Ids between 500 and 505
--模糊查询,行业里带国家两个字的 like
select *from Category where Name like'%国家%'
select *from Category where Name like'国家%'
select *from Category where Name like'%机构%'
--查询某一列里带国家两个字用'%国家%'
--查询某一列里带国家两个字开头的'国家%"
--查询某一列里以国家结尾'%国家'
--不带某个字的not like
select *from Category where Name not like '%国家%'
--查询某一列,用列名代替*
select code ,name from Category where Ids >5 and Ids <10
select code from Category where Ids >5 and Ids <10
select Ids from Category where Ids in (6,7,8,9)
select *from Category where Ids>all
(
select Ids from Category where Ids in (6,7,8,9)
)
select *from Category where Ids>all
(
select Ids from Category where Ids>1190 and Ids <1195
)
--查询一列当作参数使用
-->any大于查询出来的任何一个(最小数)
-->all大于查询出来的所有的(最大数)