1中为什么from dual这个系统表?
--1
Select
(Select Count(*) From emp)total,
(Select Count(*) From emp Where to_char(hiredate,'yyyy')='1980') "1980",
(Select Count(*) From emp Where to_char(hiredate,'yyyy')='1981') "1981",
(Select Count(*) From emp Where to_char(hiredate,'yyyy')='1982') "1982",
(Select Count(*) From emp Where to_char(hiredate,'yyyy')='1987') "1987"
From dual;
--2
Select um(Decode(to_char(hiredate,'yyyy'),'1980',1,0)) "1980",
Sum(Decode(to_char(hiredate,'yyyy'),'1981',1,0))"1981",
Sum(Count(*) totla ,
SDecode(to_char(hiredate,'yyyy'),'1982',1,0)) "1982",
Sum(Decode(to_char(hiredate,'yyyy'),'1987',1,0)) "1987"
From emp ;