1中為什么from dual這個(gè)系統(tǒng)表?
--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 ;?
2019-06-04
sql標(biāo)準(zhǔn)格式 ?select * from 表 ?
1表全用的子查詢查出了結(jié)果 ,最后不需要from表了,就必須用偽表dual來滿足格式需要了
2018-05-16
Oracle的偽表,因?yàn)閟elect 需要對(duì)象