Query List 16 to 20

 Query List

16. Query to display Name, Hire Date and Salary Review Date which is the 1st Monday after six months of employment.

 Query: 

Select Ename, Hire_date, Salary, TO_CHAR(NEXT_DAY(ADD_MONTHS(Hire_date,6),'MONDAY')) REVIEW from EMPLOYEE; 

Output:


17. Query to display Name and calculate the number of months between today and the date each employee was hired.

Query: 

Select Ename, months_between(sysdate, hire_date) "Months" from Employee;

 Output:  


18. Query to display the following for each employee:- earns monthly but wants < 3 * Current Salary >. Label the Column as Dream Salary.

 Query:

 Select Ename||' earns '||TO_CHAR(Salary)||' monthly but wants '||TO_CHAR(Salary*3)||'.' "Dream Salaries" from EMPLOYEE; 

Output:


19. Query to display Name with the 1st letter capitalized and all other letter lower case and length of their name of all the employees whose name starts with ‘J’, ’A’ and ‘M’.

Query: 

Select INITCAP(Ename) Ename, LENGTH(Ename) LENGTH FROM EMPLOYEE where Ename like 'J%' OR Ename like 'A%' OR Ename like 'M%'; 

Output:   

20. Query to display Name, Hire Date and Day of the week on which the employee started. '

Query:

 Select Ename, Hire_date, TO_CHAR(Hire_date,'DAY') from EMPLOYEE; 

Output: 












Post a Comment

© DBMS. The Best Codder All rights reserved. Distributed by