ORACLE Top/Bottom N、First/Last、NTile
目录
==================================================================
1.带空值的排列
2.Top/Bottom N查询
3.First/Last排名查询
4.按层次查询
一、带空值的排列:
假如被排列的数据中含有空值呢?
SQL> select region_id, customer_id,
2 sum(customer_sales) cust_sales,
3 sum(sum(customer_sales)) over(partition by region_id) ran_total,
4 rank() over(partition by region_id
5 order by sum(customer_sales) desc) rank
6 from user_order
7 group by region_id, customer_id;
REGION_ID CUSTOMER_ID CUST_SALES RAN_TOTAL RANK
---------- ----------- ---------- ---------- ----------
10 31 6238901 1
10 26 1808949 6238901 2
10 27 1322747 6238901 3
10 30 1216858 6238901 4
10 28
相关文档:
大家好,我在http://download.csdn.net/source/836323上发的帖子,确实只是个demo,其题库内容见下文,此为最新题库的一部分,正式版题库是175题。需要正式版本的朋友,可以直接联系我或者到www.certinside.cn/1z0-051 上面看看,我们和testinside是一家的,需要的话我可以给你打个折,价格再议。我的QQ:390970748 ......
一:
使用Profile对用户Session会话进行资源限制
--但是如果使用了连接池之类的东东,就会出些问题,比如前台连接不上之类的
--http://www.eygle.com/archives/2008/10/profile_session_limit.html
sqlplus "/ as sysdba"
SQL> show parameter resource
SQL> alter system set resource_limit= ......
CREATE OR REPLACE PROCEDURE sendemailtest
(mailmsg IN Varchar2)
IS
--using mail server to send email.
mailconn UTL_SMTP.connection;
mailhost & ......
由于系统移植,原来的数据库编码和时区都换了,原来的一些SQL文也出错了。。
经常崩出"ORA-01846: not a valid day of the week
"错误。
经测试,以下这个简单语句也会错!!
SQL> select next_day(sysdate,'FRIDAY') from DUAL;
select next_day(sysdate,'FRIDAY') from DUAL
ORA-01 ......