You are on page 1of 3

DBMS –LAB ASSIGNMENT-II

1. Display the names of all those employees where length of the name is 5? 2. Display the first 2 characters of employee name in lower case directly followed by the job. 3. Display Length of all employee names, names of employees in Upper case and proper case. Write it as a single query. 4. From the string ‘INFORMATION TECHNOLOGY’ , just display the string ‘TECH’ in your output 5. Display information from employee table in such a way that where ever job ‘Manager’ is found, it should be displayed as ‘BOSS’. 6. Display those employees whose salary is odd number. 7. of the nearest Sunday Find the day after the current day. 8. Display current date along with current time. 9. Display the names of employees who are working in the company since 6 years. 10. Find the date of the last day of the month & name the column as LAST DAY in your output. 11. Display your Age in (single query) a) Days. b) Months c )Year. 12. Display employees who joined the company in the month of January. 13. Display employees who joined the company before 20th of this month.

29. Display names of those managers whose salary is greater than average salary or equal to average salary of the Company. Display the date 6 months (single query) a) Before the current date. 21.14. 34. Display name and annual salary for all employees (annual salary=(sal+comm) *12 ) 22. Display various jobs & total no of employees in each job group. 27. of rows in the employee table. (annual salary=(sal+comm) *12 ) 30. Display those departments where there are atleast 2 employees. Find name of employee who gets the maximum pay. Find the above information for all departments having more than 2 employees.000. JOINS . 24. Display list of all users in your database. of Departments after eliminating duplicates. 17. b)After current date. 19. Arrange employee record salary wise in ascending order 33. 16. Find names of all employees whose salary is greater than atleast one employee working in department 10. Find No.maximum & minimum pay of all departments.Average . 31. Display name of the current user. of employees in department ‘SALES ’. 26. 32. Find names of all employees whose pay is Greater than the average pay. Display various jobs along with total salary for each job group where total salary is greater than 50. Give No. Get the department ID. 18. Display those employees whose manager name is JONES. Find names of all employees whose salary is greater than that of each employee working in department Research. Find the No. 28. 20. Display Names of employees along with their annual salaries and the employee earning highest salary should come first. 25. Display the following output for each row of emp table:'Smith working as clerk joined company on 11th January 1995 and has a salary of 3500 ‘ 15. 23.

40.is a foreign key referencing empno of emp table.name. deptno. Cust_name should be in Upper case. Display employee details along with their department details using full outer join. 37.deptno and department names of all employees. Create a view on emp and dept table with the fields ename. 44.35. comm. job for employees of department 30. 41. ename. VIEWS 43.should be set to default value of ‘0’ iv. Display the information of the above created view. Display those employees who are working in the same department where his manager works. INTEGRITY CONSTRAINTS 39. 36. Display employee names along with their manager names. . empno. Add the following constraints to employee table i. mgr.is a foreign key referencing deptno of department table. Show all the constraints on the dept and emp table (default tables) 42.should not be null iii. dname. Left outer join and Right outer join. Get the empno. Disable the check constraint on cust_name column from cust_dtls table. Create a table Cust_dtls such that the content of the column Cust_no is unique and not null. v.primary key ii. Cust_city starts with alphabet ‘H’. 38.