SELECT语句
单表查询
SELECT Column1, Column2from table1
多表连接查询
SELECT table1.Column1,table2.Column2from table1,table2
对选择可运算的列进行运算操作
select salary, salary * 2from employees
NULL
NULL表示 不可用、未赋值、不知道、不适用,它既不是0 也不是空格。
给查询的列起别名
select last_nameAS name, employee_id idfrom employees

select last_name AS "Name", salary * 2 "Annual Salary"from employees
字符串连接操作符
SELECT last_name, job_id AS "Employees"FROM employees;

SELECT last_name||job_id AS "Employees"FROM employees;

SELECT last_name ||' is a '||job_id AS "Employee Details"FROM employees;
DISTINCT去除重复行
默认情况,返回所有行,包括重复行
SELECT department_idFROM employees;
使用DISTINCT消除重复结果行
SELECT DISTINCT department_idFROM employees;

