数据库子查询

子查询有两种类型:

一种是只返回一个单值的子查询,这时它可以用在一个单值可以使用的地方,这时子查询可以看作是一个拥有返回值的函数;

另外一种是返回一列值的子查询,这时子查询可以看作是一个在内存中临时存在的数据表。 

分页查询语句

分页查询,要求 一页给显示5条数据
第一页
select top 5 * from renyuan
第二页
select top 5 * from renyuan where code not in(select top 5 code from renyuan)
第三页
select top 5 * from renyuan where code not in(select top 10 code from renyuan)

总共有几页????
select CEILING( COUNT(*)/5.0) from renyuan

posted on 2016-09-03 15:45  胡了个凡  阅读(148)  评论(0编辑  收藏  举报

导航