話說前陣子才剛通過了Oracle Database 11g: SQL Fundamentals I,趁記憶猶新的時候趕快來整理一下Oracle的SQL語法吧。
SELECT *│{[DISTINCT column│expression [alias],‧‧‧}
FROM table;
- SELECT *
FROM departments;
DEPARTMENT_ID | DEPARTMENT_NAME | LOCATION_ID |
10 | Marketing | 170 |
20 | Administration | 180 |
50 | IT | 150 |
80 | Sales | 170 |
- SELECT department_id, department_name FROM departments;
DEPARTMENT_ID | DEPARTMENT_NAME |
10 | Marketing |
20 | Administration |
50 | IT |
80 | Sales |
- SELECT department_name, salary, salary + 500FROM departments;
DEPARTMENT_NAME | SALARY | SALARY + 500 |
Marketing | 200 | 700 |
Administration | 500 | 1000 |
IT | 300 | 800 |
Sales | 400 | 900 |