时间:2021-07-01 10:21:17 帮助过:3人阅读
This lesson explains the SQL statements that youuse to perform these actions.
SELECT *|{[DISTINCT] column|expression [alias],...}
FROM table
[WHERE condition(s)];
?WHERE 子句紧随 FROM子句。
SELECT employee_id,last_name,job_id,department_id
FROM employees
WHERE department_id = 90 ;
SELECTlast_name,job_id,department_id
FROM employees
WHERE last_name = ‘Whalen‘;
SELECTlast_name,hire_date,department_id
FROM employees
WHERE hire_date =‘7-6月-1994‘
日期以特定的格式书写!
SELECT last_name, salary
FROM employees
WHERE salary <= 3000;
1.
SELECT last_name, salary
FROM employees
WHERE salary BETWEEN 2500 AND 3500;
2.
SELECT employee_id,last_name, salary,manager_id
FROM employees
WHERE manager_id IN (100, 101, 201);
?使用 LIKE运算选择类似的值 ?选择条件可以包含字符或数字: –% 代表零个或多个字符(任意个字符)。 _代表一个字符
3.
SELECT first_name
FROM employees
WHERE first_name LIKE ‘S%‘;
4.
SELECT last_name
FROM employees
WHERE last_name LIKE ‘_o%‘;
?可以使用 ESCAPE 标识符选择‘%’和‘_’符号。
?回避特殊符号的:使用转义符。例如:将[%]转为[\%]、[_]转为[\_],然后再加上[ESCAPE ‘\’] 即可。
SELECT job_id
FROM jobs
WHERE job_id LIKE ‘IT\_%‘ escape ‘\‘;
5.
使用IS (NOT)NULL 判断空值。
SELECT last_name,manager_id
FROM employees
WHERE manager_id IS NULL;
版权声明:本文为博主原创文章,未经博主允许不得转载。
Oracle 第2节过滤和排序数据
标签: