Lab6(Advanced Queries)
Lab6(Advanced Queries)
INNER JOINS:
Q1: Create a query that returns vendor id, vendor names, invoice dates
and invoice total amounts. { schema: ap}
Comp1168-Lab6(Rana) Page 1 of 5
Q2: Create a query that returns employees’ ids, full names and the
names of the departments they work in [This database has all
standalone tables and no inherent table relationships] { schema: ex}
OUTER JOINS:
Q3: Create a query that would return the Full Name for all employees
and their department names including employees who do not work in
any department. {schema: ex}
Comp1168-Lab6(Rana) Page 2 of 5
(a) All employees who are in a department or who do not (Left Outer
Join)
(b) Create a query that would return the Full Name for all employees
and their department names including the departments with no
employees working in it {RIGHT Outer Join}
(c) Create a query that would return the Full Name for all employees
and their department names for those employees who do NOT work in
a department {WHERE d.department_name IS NULL}
Comp1168-Lab6(Rana) Page 3 of 5
(d) Create a query that would return Employee name and Department
Names even for all departments (with or without employees in them)
and all employees (with or without assigned to a department {FULL
Outer Join simulated with a UNION QUERY}
Comp1168-Lab6(Rana) Page 4 of 5
FOUR TABLE JOIN with calculated column
Q5: Return customers’ and their order details as show below. {schema:
om}
Comp1168-Lab6(Rana) Page 5 of 5