友情提示:本文共有 919 个字,阅读大概需要 2 分钟。
查询员工表中所有的信息select*from Emp_info;
2.查询每个职工的职工号、姓名、家庭住址信息。
select emp_id,emp_name,emp_addr from Emp_info;
3.单条件查询
查询职工号为001的职工的缺勤天数,缺勤时间。
select Abs_time,Abs_time from Emp_abs where Emp_id="01"
4.多条件查询
查询所有家住在“上海”女员工信息
select*from Emp_info where Emp_sex="女" and Emp_addr= "上海"
5.between …and 关键字
查询所有缺勤天数在2~3天之间的职工号。
select Emp_id from Emp_abs where Abs_day between 2 and 3
6.in 关键字
查询员工号为“001,003,014”的员工姓名
select Emp_name from Emp_info where Emp_id in("001","003","014")
7.空值查找
从缺勤信息表中检索出缺勤描述为空值记录。
select*from Abs_info where Abs_note is null
8.like 模糊查找
查询所有姓“李”的职工的职工号、姓名。
select emp_id,emp_name from emp_info where Emp_name like"李%"
查询名字的第二个字是“晓”或“小”的所有员工的记录。
select emp_id,emp_name from emp_info where Emp_name like"_晓%"or Emp_name like "_小%"
查询名字的第二个字不是“晓”和“小”的员工的记录。
select emp_id,emp_name from emp_info where Emp_name not like"_晓%"and Emp_name not like "_小%"
9.排序
将各职工的考勤情况按缺勤天数由高到低排序。
select*from Emp_abs order by Abs_day desc
#oracle#
本文如果对你有帮助,请点赞收藏《Oracle SQL语句04——查询语句》,同时在此感谢原作者。