学习笔记和课后作业在主页其他专栏,欢迎进入主页查看
··scott用户下
--emp表
1.查询员工的名字和工资
select ename,sal
from emp
2.查询员工的编号,名字,提成
select empno,ename,comm
from emp
3.查询员工名字,职位,入职日期
select ename,job,hiredate
from emp
4.查询员工编号,名字,经理编号,部门编号
select empno,ename,mgr,deptno
from emp
--dept表
5.查询部门编号和部门名称
select deptno,dname
from dept
--salgrade表
6.查询工资等级,最低工资,最高工资
select grade,losal,hisal
from salgrade
··hr用户下
--employees表 (下面的练习请尽量用表别名)
1.查询员工编号,名字(first_name),工资,并且加上中文列别名
select employee_id 员工编号,
first_name 名字,
salary 工资
from employees
2.查询员工的名字(first_name),邮箱,电话,并且加上中文列别名
select first_name 名字,
email 邮箱,
phone_number 电话
from employees
3.查询员工的编号,入职日期,职位,部门编号,经理编号,5个列的别名分别叫1,2,3,4,5,每个列加上中文注释
select employee_id "1", --员工编号
hire_date "2",--入职日期
job_id "3",--职位
department_id "4", --部门编号
manager_id "5" --经理编号
from employees
--departments表
4.查询部门编号,部门名称
select department_id 部门编号,
department_name 部门名称
from departments
--job_history表
5.查询职位,开始日期,结束日期,取别名为J_id,S_date,E_date
select job_id J_id,
start_date S_date,
end_date E_date
from job_history
--jobs表
6.查询职位全称,最低工资,最高工资,并且加上中文列别名
select job_title 职位全称,
min_salary 最低工资,
max_salary 最高工资
from jobs
--regions表
7查询区域编号,区域名称
select region_id 区域编号,
region_name 区域名称
from regions
--locations表
8查询国家简称,街道地址,邮政编码
select country_id 国家简称,
street_address 街道地址,
postal_code 邮政编码
from locations
9查询位置编号,街道地址,城市
select postal_code 位置编号,
street_address 街道地址,
city 城市
from locations
116

被折叠的 条评论
为什么被折叠?



