Posted Date: 13-5-2023
Exercise: III
Operators and Functions
Aim: To understand different operators and types of function in SQL
1. Find the employee names having salary greater than Rs.25000.
2. Find the employee names whose salary lies in the range between 30000 and 70000.
3. Find the employees who have no supervisor.
4. Display the bdate of all employee s in the format ‘DDthMonthYYYY’.
5. Display the employee names whose bdate is on or before 1978.
6. Display the employee names having ‘salt lake’ in their address.
7. Display the department name that starts with ’M’.
8. Display the department names’ that ends with ‘E’.
9. Display the names of all the employees having supervisor with any of the following
SSN 554433221, 333445555.
10. Display all the department names in upper case and lower case.
11. Display the first four characters and last four of the department names using substring
function.
12. Display the substring of the Address (starting from 5th position to 11 th position) of all
employees.
13. Display the Mgrstartdate on adding three months to it.
14. Display the age of all the employees rounded to two digits.
15. Find the last day and next day of the month in which each manager has joined.
16. Print a substring from the string ‘Harini’.
17. Replace the string ‘ni’ from ‘Harini’ by ‘sh’.
18. Print the length of all the department names.
19. Print the system date in the format 25 th May 2007.
20. Display the date after 10 months from current date.
21. Display the next occurrence of Friday in this month.
22. Convert SSN of employee to Number format and display.
23. Display the project location padded with **** on left side.
24. Remove the word ‘Project’ from the project name and display it.
25. Select the SSN of the employee whose dependent name is either Michaelor Abner.
Exercise: IV
Group Functions
1. How many different departments are there in the ‘employee’ table
2. For each department display the minimum and maximum employee salaries
3. Print the average annual salary.
4. Count the number of employees over 30 age.
5. Print the Department name and average salary of each department.
6. Display the department name which contains more than 30 employees.
7. Calculate the average salary of employees by department and age
8. Count separately the number of employees in the finance and research department.
9. List out the employees based on their seniority.
10. List out the employees who works in ‘manufacture’ department group by first name