NATURAL JOINs
SELECT with a NATURAL INNER JOIN
In this exercise we will query the products table using a NATURAL INNER JOIN with the order_details table.
SELECT DISTINCT products.product_id,products.product_name,order_details.unit_priceFROM productsNATURAL INNER JOIN order_detailsORDER BY products.product_id;Run in terminal
The query should return 76 rows.
SELECT with a NATURAL LEFT JOIN
In this exercise we will query the customers table using a NATURAL LEFT JOIN with the orders table.
SELECT DISTINCT customers.customer_id,customers.contact_name,orders.ship_regionFROM customers NATURALLEFT JOIN ordersORDER BY customers.customer_id DESC;Run in terminal
The query should return 91 rows.
SELECT with a NATURAL RIGHT JOIN
In this exercise we will query the customers table using a NATURAL RIGHT JOIN with the orders table.
SELECT DISTINCT customers.company_name,customers.contact_name,orders.ship_regionFROM customers NATURALRIGHT JOIN ordersORDER BY company_name DESC;Run in terminal
The query should return 89 rows.