SQL Joins (AdventureWorks)
Answer these questions using the AdventureWorks database provided
in the
sample databases
repository. The ERD in the repository shows how the different relations
(and, depending on your DBMS, schemata) work together.
Run the following queries (there is more than one way to write most of
these queries).
- Join (Inner) productmodel, productmodelproductiondescriptionculture,
productdescription and culture from the production schema. Return the
productmodel name, culture name, and productdescription description ordered
by the product model name.
- Add a join to previous example to production.product and return the
product name field in addition to other information.
- Join product and productreview.
Include every record from product and any reviews they have. Return the
product name, review rating and comments. Order by rating in ascending
order.
- Use a right join to combine workorder and product from production schema
to bring back all products and any work orders they have. Include the
product name and workorder orderqty and scrappedqty fields. Order by
productid ascending.