首页 > 代码库 > 20141124
20141124
select*from category where Parent=‘011‘or‘012‘or‘013‘ select*from Category where Parent not in(‘011‘,‘012‘,‘013‘)--parent不是012,013,011的 select*from Category where Ids>500 and ids<505--id大于500,小于505的 select*from Category where Ids between 500 and 505--between and 相当于大于等于,小于等于 select*from Category where Name like ‘%国家%‘--模糊查询,行业里边带国家两个字的. select*from Category where Name like ‘%机构‘--模糊查询,行业里边带国家两个字的. select*from Category where Name not like‘%国家%‘--not like 不带国家两个字的 select code,name from category where Ids>5 and Ids<10--子查询 select*from Category where Ids >all(--大于所有 select*from Category where Ids >any(--大于任意的一个 --排序 select *from Category order by ids asc--升序默认不写 select *from Category order by ids desc--降序一定要写 select *from Category order by Parent,Ids--先排parent后再按ids排 select *from Category order by Parent,Ids desc select *from Category order by Parent desc,Ids desc select parent from Category group by parent--对他们分组 select code from Category where Parent=‘m‘--组名 select distinct parent from Category--将一列去重显示 select top 5 *from Category--前多少条数据 select top 5*from Category order by ids--前多少条排序 select top 5*from Category where Ids>900 and Ids<950 order by
建表--学生信息表 学号,姓名,班级,性别,教师,出生日期 身高--添加20虚拟数据--查询男同学身高170以上 --查询姓王的同学信息--查询一共有几个班级--查询女同学里身高在168,170,172这三个数得信息。
20141124