Source: https://thodrek.github.io/cs564-fall17/lectures/lecture-4/Lecture_4_SQL_Adv_II.pdf