Oracle SQL 的 ORDER BY 子句支持以下幾種排序方式:
示例:
SELECT * FROM employees
ORDER BY salary ASC;
示例:
SELECT * FROM employees
ORDER BY salary DESC;
示例:
SELECT * FROM employees
ORDER BY department_id, salary DESC;
示例:
SELECT * FROM employees
ORDER BY department_id NULLS FIRST, salary DESC;
示例:
SELECT * FROM employees
ORDER BY LENGTH(last_name) DESC;
示例:
SELECT * FROM employees
ORDER BY CASE WHEN salary > 5000 THEN 1 ELSE 0 END DESC, salary DESC;
這些是 Oracle SQL 中 ORDER BY 子句支持的常見排序方式。在實際應用中,可以根據需求選擇合適的排序方式。