In order to use foreign keys correctly, the parent table reference must be a unique column. The trackwords table references the recordings table's id column. Therefore, the recordings table has to be split up into recordings which has information about the recording, and medium_recordings which maps recordings to a medium.