概述
1. Oracle数据库
SELECT * FROM TABLENAME WHERE ROWNUM <= N
2. Infomix数据库
SELECT FIRST N * FROM TABLENAME
3. DB2数据库
SELECT *
FROM (SELECT * ROW_NUMBER() OVER({ORDER BY COL1 DESC}) AS ROWNUM FROM TABLENAME)
WHERE ROWNUM <= N
或者
SELECT COLUMN FROM TABLENAME FETCH FIRST N ROWS ONLY
4. SQL Server数据库
SELECT TOP N * FROM TABLENAME
5. Sybase数据库
SET RO
WCOUNT N
GO
SELECT * FROM TABLENAME
6. MySQL数据库
SELECT * FROM TABLENAME LIMIT N
7. FoxPro数据库
SELECT * TOP N FROM TABLENAME ORDER BY COLUMN
********
access:
select top* from table1 where 1=1
db2:
select column from table where 1=1 fetch first 10 rows only
mysql:
select * from table1 where 1=1 limit 10
sql server:
读取前10条:select top* from table1 where 1=1
读取后10条:select top* from table1 order by id desc
在sqlserver里面,如何读取按照某个排序,第5到10这五个记录
select top 6 * from table where id not in
oracle:
select * from table1 where rownum=10
LINK:http://gcq04552015.iteye.com/blog/1156437
********************
LINK:http://blog.sina.com.cn/s/blog_6da7fcff0100yx1p.html
最后
以上就是想人陪鸭子为你收集整理的数据库:读取前几条数据的全部内容,希望文章能够帮你解决数据库:读取前几条数据所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复