日期:2014-05-16 浏览次数:20428 次
01.?? tmp表中有如下记录(建表 SQL见emp.sql)
?
RQ???????? SHENGFU
---------- ----------
2005-05-09 WIN
2005-05-09 WIN
2005-05-09 LOSE
2005-05-09 LOSE
2005-05-10 WIN
2005-05-10 LOSE
2005-05-10 LOSE
?
要求格式为:
?
RQ??????????????? WIN?????? LOSE
---------- ---------- ----------
2005-05-10????????? 1????????? 2
2005-05-09????????? 2????????? 2
?
?
答案:select rq,? count(case when shengfu='WIN' then 'WIN' else null end) WIN, count(case when shengfu='LOSE' then 'LOSE' else null end) LOSE from tmp group by rq ;
?
?
02.?? 查询当前月有多少天
?
答案:SQL> select trunc(add_months(sysdate,1),'month') - trunc(sysdate,'month') from dual;
?
?
03.?? pages表有四个字段,<