Lab 8 DBMS
Lab 8 DBMS
Ques 1: Execute a query that does cross join on both the tables.
Ques 2: List dept details of all employees. What type of join is this?
Type of join: INNER JOIN – This join returns employees along with department details where
the deptid matches in both tables
Ques 3: List employee details of all departments. What type of join is this?
Type of join: INNER JOIN – This query returns all employees and their corresponding
department details where deptid matches.
Ques 4: Execute a left join that selects all departments and any employees the department
may have.
Ques 5: Execute full outer join on both the tables. How are the results different from query 1.
Difference from Query 1 (CROSS JOIN): A FULL OUTER JOIN will display all rows from
both tables, while a CROSS JOIN produces all combinations of rows between the two tables
(Cartesian product).
Ques 6: Execute a query that returns the names and dept 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)
Type of Join: SELF JOIN – A self join is used to join the table with itself. It finds pairs of
employees who belong to the same department.
Ques 7: Execute a query that returns the names, dept 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)
Ques 8: Execute a query which returns department name of that department that gives
highest salary summed over their employees.
-x-x-x-