Databases · Junior · Question 25 of 75

A user has 3 orders and 2 addresses. You join users, orders and addresses on user_id. How many rows do you get for that user?

Explanation

Joining two independent one-to-many relations multiplies rows (3 × 2). Sums and counts over such a join are inflated; aggregate each relation separately.

Further reading

Problem with a question

Databases · Junior · question 25

Test yourself

Take the Databases · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz