sql 查询语句的练习

--1、使用基本查询语句.
--(1)查询DEPT表显示所有部门名称.
select * from dept;
--(2)查询EMP表显示所有雇员名及其全年收入(月收入=工资+补助),处理NULL行,并指定列别名为"年收入"。(NVL(comm,0) comm取空值时用0替代)
select ename,12*(sal+nvl(comm,0)) "年收入" from emp;
--(3)查询显示不存在雇员的所有部门号。
select d.deptno from dept d where d.deptno not in (select distinct deptno from emp)

猜你喜欢

转载自www.cnblogs.com/cqming/p/10738209.html