Dbms Assignment II

download Dbms Assignment II

of 3

Transcript of Dbms Assignment II

  • 7/29/2019 Dbms Assignment II

    1/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.

  • 7/29/2019 Dbms Assignment II

    2/3

    14. 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. Find the No. of rows in the employee table.

    16. Find No. of employees in department SALES .

    17. Give No. of Departments after eliminating duplicates.

    18. Get the department ID,Average ,maximum & minimum pay of all departments.

    19. Find the above information for all departments having more than 2 employees.

    20. Display the date 6 months (single query)

    a) Before the current date. b)After current date.

    21. 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.

    23. Display various jobs along with total salary for each job group where total salary isgreater than 50,000.

    24. Display those departments where there are atleast 2 employees.25. Find name of employee who gets the maximum pay.

    26. Find names of all employees whose pay is Greater than the average pay.

    27. Display list of all users in your database.

    28. Display name of the current user.

    29. Display Names of employees along with their annual salaries and the employee earninghighest salary should come first. (annual salary=(sal+comm) *12 )

    30. Find names of all employees whose salary is greater than atleast one employee working indepartment 10.

    31. Find names of all employees whose salary is greater than that of each employee working indepartment Research.

    32. Arrange employee record salary wise in ascending order

    33. Display those employees whose manager name is JONES.

    34. Display names of those managers whose salary is greater than average salary or equal toaverage salary of the Company.

    JOINS

  • 7/29/2019 Dbms Assignment II

    3/3

    35. Get the empno,name,deptno and department names of all employees.

    36. Display employee names along with their manager names.

    37. Display those employees who are working in the same department where his manager works.

    38. Display employee details along with their department details using full outer join, Left outerjoin and Right outer join.

    INTEGRITY CONSTRAINTS

    39. Create a table Cust_dtls such that the content of the column Cust_no is unique and not null,Cust_name should be in Upper case, Cust_city starts with alphabet H.

    40. Add the following constraints to employee tablei. empno- primary keyii. ename- should not be nulliii. comm- should be set to default value of 0iv. deptno- is a foreign key referencing deptno of department table.

    v. mgr- is a foreign key referencing empno of emp table.

    41. Show all the constraints on the dept and emp table (default tables)

    42. Disable the check constraint on cust_name column from cust_dtls table.

    VIEWS

    43. Create a view on emp and dept table with the fields ename, dname, job for employees ofdepartment 30.

    44. Display the information of the above created view.