Create a query that display the last name,hire date and the day of the week on which the employee started. Label the column DAY. Order the results by the day of the week starting with Monday.
LAST_NAME HIRE_DATE DAY
Grant 24-MAY-99 MONDAY Ernst 21-MAY-99 TUESDAY Mourgos 16-NOV-99 TUESDAY ---- --- -----
RE: Create a query that display the last name,hire dat...
if we order by hire date it will give the dates in ascending order which is fine but if we order by day then it will give the days in ascending order like monday friday saturday sunday thurday.... (alphaebetically)it wont give monday tueday wednesday
RE: Create a query that display the last name,hire date and the day of the week on which the employee started. Label the column DAY. Order the results by the day of the week starting with Monday.LAST_NAME HIRE_DATE DAYGrant 24-MAY-99
select last_name hire_date to_char(hire_date 'DAY') as DAY from emp order by to_char(hire_date-1 'd');
RE: Create a query that display the last name,hire date and the day of the week on which the employee started. Label the column DAY. Order the results by the day of the week starting with Monday.LAST_NAME HIRE_DATE DAYGrant 24-MAY-99
NANDU@NQP3>select dayofweek Day from test456;
DAY -------------------- Sunday Monday Tuesday Wednesday Thursday Friday Saturday
7 rows selected.
NANDU@NQP3>select dayofweek day decode(dayofweek 'Monday' 1 2 'Tuesday' 2 3 'Wednesday' 3 4 'Thursday' 4 5 'Friday' 5 6 'Saturday' 6 7 'Sunday' 7) DISCARD_STUFF 8 from test456 order by 2;