Sei sulla pagina 1di 2

Rubio Remuel Addbase BSIT-3101

Open a New Query editor to combine the two tables using the INNER JOIN syntax as follows:

Code Result
SELECT Customertbl.CustomerID,
Customertbl.FirstName, Customertbl.LastName,
Customertbl.Item, Orderstbl.Quantity FROM
Customertbl INNER JOIN Orderstbl ON
Customertbl.CustomerID =
Orderstbl.CustomerID;

Observe what happened when two tables joined using the INNER JOIN clause.
1. Considering the two tables above (CustomerTbl and OrdersTbl), what do you think will happen to the
information on the first and second table if combined?
Ans: the table shows all the information whatever the two table has the same row data
2. What will happen to the customers who doesn’t have items ordered?
Ans: NULL
3. Write you’re your observation on a sheet of paper.

Code Result
SELECT CustomerTbl.CustomerID
,CustomerTbl.FirstName,
CustomerTbl.LastName, OrdersTbl.Item,
OrdersTbl.Quantity FROM CustomerTbl RIGHT
JOIN OrdersTbl ON CustomerTbl.CustomerID =
OrdersTbl.CustomerID;

Observe what happens when two tables are being joined using the RIGHT JOIN clause.
1. Considering the two tables above (CustomerTbl and OrdersTbl), what do you think will happen to the
information on the second table if combined to the first table?
Ans: it returns all records from the right table (CustomerTbl ), even if there are no matches in the left
table (OrdersTbl).
2. What will happen to the customers who doesn’t have items ordered?
Ans: The result is NULL from the OrdersTbl, when there is no match.
3. Write you’re your observation on a sheet of paper.
Code Result
SELECTt blCustomers.CustomerID,
tblCustomers.FirstName,
tblCustomers.LastName,
tblItems_Ordered.Item,
tblItems_Ordered.Quantity
FROMtblCustomers FULL JOIN
tblItems_Ordered ON
tblCustomers.CustomerID =
tblItems_Ordered.CustomerID;

Observe what happens when two tables are being joined using the FULL JOIN clause.
1. Considering the two tables above (CustomerTbl and OrdersTbl), what do you think will happen to the
information on the first table and second table if combined?
Ans: it joined all records from both the tables and fill in NULLs for missing matches on either side.
2. What will happen to the customers who doesn’t have items ordered?
Ans: Null
3. Write you’re your observation on a sheet of paper