1,select getdate() as [Date]
2, select 雇员代码,姓名,工资, 工资*1.15 as [New Salary] from table
3,
4,select 雇员姓名,datediff(month,雇佣日期,getdate())+1 as 月数 from table
5,select 雇员姓名,雇佣日期,DATEPART(weekday, 雇佣日期) from table
6, select 雇员姓名,工资,isnull(补助,'wu') as 补助 from table
•显示当前日期,标题为“Date” •select sysdate as "Date" from dual •显示雇员代码、姓名、工资以及新工资(增加15%),标题为“New Salary” •select empno,ename,sal,sal+sal*0.15 "NEW salary" from emp •显示雇员名、雇佣日期以及工资复查日期(6个月后的第一个星期一),格式为“monday, the Seventh of September, 1981.” •select ename,hiredate,next_day(add_months(hiredate,6),'星期一') from emp •显示雇员姓名以及已被雇佣的月数 •SELECT ename,hiredate,TRUNC(MONTHS_BETWEEN(SYSDATE,hiredate)) FROM emp; •显示雇员姓名、雇佣日期,以及开始工作的工作日(星期几) •select ename,hiredate,to_char(HIREDATE, 'DAY') from emp •显示雇员姓名、工资及补助,如果补助为NULL,则显示“无补助” •select ename,sal,nvl(comm,'无补助') from emp