SQL
From SkyWiki
(Difference between revisions)
(Sybase, Firebird) |
m (→TOP SELECT) |
||
Line 22: | Line 22: | ||
- | ===TOP SELECT=== | + | ===TOP n SELECT=== |
MySQL: | MySQL: | ||
<source lang=sql> | <source lang=sql> |
Revision as of 06:58, 16 September 2008
traditional Oracle outer join syntax
left outer join
right outer join
inner join
TOP n SELECT
MySQL:
SELECT EMPNO, ENAME, JOB, MGR, SQL FROM EMP LIMIT 10 offset 20
Oracle >= 8.1.6:
SELECT * FROM (SELECT JOB_NUM, JOB_NME, START_DT_GMT, STATUS_CD, rank() over(partition BY JOB_NUM ORDER BY START_DT_GMT DESC ) rn FROM NM_SCHD_JOB_RUN ) WHERE rn BETWEEN 20 AND 30 SELECT EMPNO, ENAME, JOB, MGR, SAL, rank() over (ORDER BY SAL DESC NULLS LAST) AS RANK, dense_rank() over (ORDER BY SAL DESC NULLS LAST) AS DRANK FROM EMP ORDER BY SAL DESC NULLS last;
MS SQL Server:
SELECT top 10 EMPNO, ENAME, JOB, MGR FROM EMP
Sybase:
SET rowcount 10 SELECT COLUMNS FROM TABLE
Firebird:
SELECT first 10 COLUMNS FROM TABLE