SESSION NAME: Joins and Unions-2.
QUESTION NAME: Joins of two tables - Hackers - Right Join.
TABLE DESCRIPTION:
Write a Query to Join the following tables - Use Right Join
1. We have a table called joins_suppliers with two fields
(supplier_id and supplier_name)
2. We have another table called orders with three fields
(order_id, supplier_id, and order_date)
Write the query to get the following result set
supplier_id supplier_name order_year
10000 IBM 2013
10001 Hewlett Packard 2013
10002 Microsoft
10003 NVIDIA
1. We have a table called joins_suppliers with two fields
(supplier_id and supplier_name)
2. We have another table called orders with three fields
(order_id, supplier_id, and order_date)
Write the query to get the following result set
supplier_id supplier_name order_year
10000 IBM 2013
10001 Hewlett Packard 2013
10002 Microsoft
10003 NVIDIA
CODE:
select joins_suppliers.supplier_id,
joins_suppliers.supplier_name, orders.order_year from
joins_suppliers Left Outer Join orders on joins_suppliers.supplier_id
= orders.supplier_id ;
0 Comments