CM252 DBMS - Labcycle 01
CM252 DBMS - Labcycle 01
EMPLOYEE:
DEPARTMENT:
SALGRADE:
1. Display the department names in the lower case but the initial must be in uppercase.
2. Determine the ‘ename’, ‘job’, ‘sal’ rename the title as Job-sal the output must be
Job-Sal as SMITH[CLERKRS.2000]
3. Count the number of times S occurs in department names
4. Write a query to display the department name which does not contains any employees.
5. Write a query to display all employee details where employee was joined in year date
wise 1980 and 1990 and 3rd week of every month
6. Write an SQL statement to convert the current date to new date picture ex: MONDAY 10th
2005 10:30.00 PM
7. Write a query to display all employee details who joined 3rd week Wednesday of every month
and experience should be greater than 20 months.
8. Write a query to calculate the length of time of any employee who has been with the company.
9. Write a query that will display all different job types.
10. Write a query that will display list of employees and their salary and the comments as
follows.
If the salary is more than 1500 then display “above target”
If the salary is equal to 1500 then display “on the target”
If the salary is less than 1500 then display “below the target”
11. Display all employee names, employee number, department names & salary grades for all
employees who are working in department 30.
12 Display only those jobs where the maximum salary is greater than or equal to $3000.
13 Find all departments which have more than 3 employees.
14 Display the time of day.
2
CYCLE NO: 01 PROGRAM NO : 02
STATEMENT: QUERIES WITH GROUP FUNCTIONS AND NESTED QUERIES.
2.01 Find all employees who earn a salary greater than the average salary of their departments.
2.02 Write a query to sort names of employees in department 10 & 20 in alphabetical order
2.03 Write a query to display all job types.
2.04 Calculate the number of employees and average salary of each department.
2.05 Write a query to find the name of the manager and number of sub-ordinates.
2.06 Write a query to find out the manager having Maximum number of sub-ordinates.
2.07 a) Write a query to find out the top three earners.
b) Write a query to find out the least three earners.
2.08 Display the average, monthly salary bill for each job type with in department.
2.09 Find all employees whose dept is not in dept table.
2.10 a) Write a query to find out the employees who have joined before their managers.
b) Write a query to find out the year, where most people join in the company displays the
year and No. Of Employees.
211 a) List the department names of each employee.
b) Find all employees who earn lowest salary in each department.
2.12 a) Display all employees who earn more than the lowest salary of department 30.
b) Display all departments, which have the highest average salary of all departments.
2.13 Write a query which will return the DAY of the week.(ie. MONDAY), for any date entered in
theformat : DD.MM.YY.
2.14 List all employees by name and number along with their manager’s name and number.
2.15 Find the job that was filled in the second half of 1981, and the same job that was filled during
the same period in 1980.
2.16 List all departments where there are no employees.(USING SUBQUERY)
2.17 List the first three rows of a employee table.
3
2.18. List all the employees whose salary is more than salary of any employee in dept 30.