You want to merge two Azure SQL tables so the combined table contains all rows from Product and the matching rows from ProductCategory. Which join configuration should you use?

Prepare for the Fabric Analytics Engineer Associate Test with comprehensive materials. Explore flashcards, multiple choice questions, and detailed explanations. Get ready for your success!

Multiple Choice

You want to merge two Azure SQL tables so the combined table contains all rows from Product and the matching rows from ProductCategory. Which join configuration should you use?

Explanation:
Use a left outer join with the Product table as the left side and ProductCategory as the right side. A left outer join returns every row from the left table and the matching rows from the right table; if there is no match, the right-side columns appear as null. This exactly produces all products, plus their category information when it exists, while still showing every product even if it has no category. If you used a left anti join, you’d get only products that have no matching category, which is the opposite of what you want. Swapping the tables and using a left outer join would return all rows from ProductCategory (the right side in that arrangement) rather than all products, which isn’t the goal.

Use a left outer join with the Product table as the left side and ProductCategory as the right side. A left outer join returns every row from the left table and the matching rows from the right table; if there is no match, the right-side columns appear as null. This exactly produces all products, plus their category information when it exists, while still showing every product even if it has no category.

If you used a left anti join, you’d get only products that have no matching category, which is the opposite of what you want. Swapping the tables and using a left outer join would return all rows from ProductCategory (the right side in that arrangement) rather than all products, which isn’t the goal.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy