Oracle SQL Quick reference
June 24th, 2009
2 comments
Oracle SQL Quick Reference
SELECT Query Statement
SELECT [DISTINCT] {*, column [alias],…}
FROM table
WHERE condition(s)]
ORDER BY {column, exp, alias} [ASC|DESC]]
NOTE:
Avoid using DISTINCT with large table as it first does sorting of all the rows and then eliminates duplicate rows, so need a full table scan and thus it’s very slow.
ORDER BY is the last clause to get executed and thus could see all the column aliases; You can sort by a columns that is not in SELECT list; Default sorting order is Ascending (ASC)
Categories: Oracle, Oracle SQL