0% found this document useful (0 votes)
8 views

DBMS Lab 8

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

DBMS Lab 8

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

DBMS

Lab Exercise- 8

In the previous lab, you had constructed the following tables under the University database:

Dept (deptid, dname, hod, address)


Employee (empno, ename, salary, designation, date of birth, date of joining,
deptid)

With suitable primary key and foreign key. Insert few entries in both tables such that:
a) Deptt. id is not common in both tables.
b) Deptt. Id is common in both tables.

1. Execute a query that does cross join on both the tables


2. List department details of all employees. What type of join is this ?
3. List employee details of all departments. What type of join is this ?
4. Execute a left join that selects all departments and any employees the department may
have.
5. Execute a full outer join on both tables. How the results are different from query 1.
6. Execute a query that returns the names and deptt IDs of all employees who have the
same department ID ordered by department ID. What type of join is this ?
Hint: your output will contain columns – Employee Name 1, Employee Name 2, Deptt. ID
7. Execute a query that returns the names, deptt IDs and department name of all
employees who have the same department ID ordered by department ID.
Hint: your output will contain columns – Emp. Name 1, Emp. Name 2, Deptt. ID, Deptt.
Name
8. Execute a query which returns department name of that department that gives highest
salary summed over their employees.

You might also like