1.查詢表中所有數據
示例:spa
SELECT * FROM employees;
說明:3d
2.查詢表中特定列數據
示例:code
SELECT department_id, location_id FROM departments;
注意:blog
算術運算符字符串
操做符 | 描述 |
+ | 加 |
- | 減 |
* | 乘 |
/ | 除 |
示例:數學
SELECT last_name, salary, salary + 300 FROM employees;
操做符優先級
io
操做符優先級示例一:
table
SELECT last_name, salary, 10*salary+100 FROM employees;
使用括號示例二:ast
SELECT last_name, salary, 10*(salary+100) FROM employees;
定義空值
class
示例:
SELECT last_name, job_id, salary, commission_pct FROM employees;
空值在數學運算中的使用
列的別名
使用別名
示例一:
SELECT last_name AS name, commission_pct comm FROM employees;
示例二:
SELECT last_name "Name", salary*12 "Annual Salary" FROM employees;
鏈接符:
字符串
示例:
SELECT last_name||' is a '||job_id AS "Employee Details" FROM employees;
重複行
刪除重複行
示例:
SELECT DISTINCT department_id FROM employees;
顯示錶結構
DESCRIBE employees;