博主资料

留言 加为好友 收藏

用户名:  sanpiyujie
来自:  北京 东城

日历

2008 8.28 Thu
     12
3456789
10111213141516
17181920212223
24252627282930
31      
«» 2008 - 8 «»

文章搜索

文章列表

最新评论

日志文章列表

2008年06月11日 22:22:49

数据库中前n条记录

在oracle数据库中查询结果的行号使用伪列ROWNUM表示(从1开始)。例如select * from employee where rownum<10 返回前10条记录。但因为rownum是在查询之后排序之前赋值的,所以查询employee按birthday排序的第1..

阅读全文>>

Tags: rownum  

类别: 数据库 |  评论(0) |  浏览(153) |  收藏
2008年06月11日 22:09:49

Oracle 中rownum的用法

选择表中的某一行记录:(理解:rownum是oracle系统顺序分配为从查询返回的行的编号)
select * from (select rownum a,t.* from testtab t) where a=2;
select * from (select rownum a,t.* from testtab t) where ..

阅读全文>>

Tags: oracle  

类别: 数据库 |  评论(0) |  浏览(207) |  收藏
2008年06月11日 21:58:32

三种数据库不同的取前10条记录

oracle取前十条记录
select rownum,t.* from tableName t where rownum <=10

mysql取前十条记录
select t.* from tableName t where limit 10

sql取前十条记录
select top 10 t.* from tableName t

阅读全文>>

Tags: sql  

类别: 数据库 |  评论(0) |  浏览(203) |  收藏