Oracle学习--01一些简单的SQL语句
程序员文章站
2022-07-14 21:43:30
...
1.过滤 。
select first_name,last_name,department_id,salary
from employees
where department_id=90
where:将不满足条件的数据过滤掉。
2.查询工资在两个值之间(包含边界)。
select first_name,last_name,department_id,salary
from employees
where salary between 3000 and 4000
between…and…:两个值之间。
3.查询指定的工资数值。
select first_name,last_name,department_id,salary
from employees
where salary in (3000,3800,4000)
int:显示指定的值。
4.模糊查询。
select first_name,last_name,department_id,salary
from employees
where first_name like 'S%'
like:选择类似的值。%:代表零个或多个字符;_:代表一个字符。
5.排序。
--降序
select first_name,last_name,department_id,salary
from employees
order by salary desc
--升序
select first_name,last_name,department_id,salary
from employees
order by salary asc
asc(asccend):升序;desc(descend):降序;