Oracle查询

前端之家收集整理的这篇文章主要介绍了Oracle查询前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
//分页查询
select * from (select a.*,rownum as rn from JMONSTER a) b where b.rn between 0 and 3;

//SELECT语句主要的字句
select select_list [INTO new_table] From table_source[WHERE search_condition] [GROUP BY group_by_expression] [HAVING search_condition] [ORDER BY oder_expression [ASC|DESC]]

//获取系统当前时间
SELECT SYSDATE FROM Dual;

//获取两个日期之间的月份
SELECT MONTHS_BETWEEN('23-4月-09','23-5月-09') FROM Dual

//返回下个指定星期数的准确日期
SELECT NEXT_DAY(SYSDATE,'星期5') FROM Dual

//当月的最后一天
SELECT LAST_DAY(SYSDATE) FROM Dual

//对日期进行四舍五入
SELECT ROUND(SYSDATE,'YEAR') FROM Dual

//日期格式
SELECT TO_CHAR(SYSDATE,'YYYY MM DD HH12:MI:SS') FROM Dual

//to_date
SELECT TO_DATE('2009-03-26 23:51:52','YYYY-MM-DD HH24:MI:SS') FROM Dual

//并集操作
SELECT ID,NAME FROM WOODS UNION SELECT ID,NAME FROM ITEMS WHERE NAME LIKE '%木%'

//交集操作
SELECT ID,NAME FROM WOODS INTERSECT SELECT ID,NAME FROM ITEMS WHERE NAME LIKE '%木%'

//差集运算
SELECT ID,NAME FROM WOODS MINUS SELECT ID,NAME FROM ITEMS WHERE NAME LIKE '%木%'

//递归查询
SELECT ID,PARANTID,NAME FROM DEPARTMENT START WITH ID=0 CONNECT BY PRIOR ID = PARANTID
原文链接:https://www.f2er.com/oracle/208359.html

猜你在找的Oracle相关文章