您的位置:首页 > 数据库

各种数据库sql语句取表中n-m条数据

2010-10-07 05:35 281 查看
命题:写出一条Sql语句: 取出表A中第31到第40记录(自动增长的ID作为主键, 注意:ID可能不是连续的。)

Oracle
数据库
中:

1、select * from A where rownum<=40 minus select * from A where rownum<=30

sqlserver数据库中:

1、select top 10 * from A where id not in (select top 30 id from A )

2、select top 10 * from A where id>(select max(id) from (select top 30 id A) as A)

MySQL
数据库中:

SELECT * FROM A LIMIT 30,40
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐