作者: 主页
我的专栏 C语言从0到1 探秘C++ 数据结构从0到1 探秘Linux 欢迎关注:点赞收藏✍️留言
码字不易,你的点赞收藏❤️关注对我真的很重要,有问题可在评论区提出,感谢阅读!!!
SQL> SELECT * FROM dba_tables WHERE OWNER = 'HR';
未选定行
SELECT employee_id as 员工编号, last_name as 姓, first_name as 名, hire_date as 雇佣日期,
job_id as 工作代号, salary as 薪水, manager_id as 经理代号, department_id as 部门代号
FROM employees
WHERE salary BETWEEN 3000 AND 6000
ORDER BY department_id ASC, employee_id DESC;
select department_id as 部门编号,count(*) as 人数, avg(salary) as 平均薪水,
max(salary) as 最高薪水,min(salary) as 最低薪水
from employees
group by department_id
order by department_id asc;
SELECT e.employee_id as 员工编号, e.first_name, e.phone_number as 电话号码,
e.department_id as 部门编号, d.department_name as 部门名称
FROM employees e
JOIN departments d ON e.department_id = d.department_id
WHERE SUBSTR(e.first_name, 3, 1) = 't';
SELECT employee_id as 员工编号, MONTHS_BETWEEN(end_date,start_date) AS 任职历时月份,
job_id as 工作代号, department_id as 部门代号
FROM job_history
WHERE MONTHS_BETWEEN(end_date,start_date) > 12;
SELECT employee_id as 员工编号, first_name || ' ' || last_name AS 姓名, salary as 薪水, department_id as 部门号
FROM employees
WHERE employee_id IN (SELECT manager_id FROM departments);
通过本次实验,我顺利达成了以下目标:
在实际操作中,我完成了对HR示例方案中表的查询,并对员工信息进行了多种复杂的查询操作,包括薪水范围筛选、部门统计、字符串匹配等。通过这些操作,我对SQL语言的灵活运用有了更深入的理解,并且在实践中熟悉了SQL Plus常用命令的使用。
总的来说,通过本次实验,我对SQL语言的查询功能和在Oracle中添加示例方案的方法有了更清晰的认识,并且在实践中提升了自己的操作技能。这些知识和技能对于今后在数据库管理和数据分析方面的工作将会有很大帮助。