W3. SQL Full Join Flashcards
Q: What does the SQL FULL OUTER JOIN keyword do?
A: It returns all records when there is a match in either the left or right table. Unmatched records in each table are also included.
Q: Is there a difference between FULL OUTER JOIN and FULL JOIN?
A: No, FULL OUTER JOIN and FULL JOIN are the same.
Q: Write the syntax for a FULL OUTER JOIN.
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name
WHERE condition;
Q: Write a query to return all customers and all orders, using FULL OUTER JOIN.
SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
FULL OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
ORDER BY Customers.CustomerName;
Q: What happens to rows without matches in a FULL OUTER JOIN?
A: Rows without matches in one table are included, with NULLs for columns from the other table.
Q: Why should you be cautious when using FULL OUTER JOIN?
A: It can return very large result sets, especially with large tables.