Source: https://fileadmin.cs.lth.se/cs/Education/EDA216/exercises/dbtexercises.pdf