Best April deals - hours only!Up to 80% off on all courses and bundles.-Close
Dictionary database
11. Person table – exercise 2


Okay, try this one!


List all pairs of full siblings. Full siblings are people who have the same mother and the same father. Name the columns with sibling names younger_sibling and older_sibling (use column year_born to identify who is younger).

You can assume that in our database no two siblings were born in the same year and there are no more than two siblings per family.

Stuck? Here's a hint!


SELECT AS younger_sibling, AS older_sibling
FROM person AS ys
JOIN person AS os
  ON ys.mother_id = os.mother_id AND ys.father_id = os.father_id
WHERE ys.year_born > os.year_born