Data model composite primary keys - Kosudo/nextSIS GitHub Wiki

A primary key is a unique value so while a special 'id' field is commonly used there is a case for making composite primary keys, but generally I've gone with the first method, the exception being in 'link tables'.

'Link tables' are tables which relate entities, for example the 'student' entity with the 'course' entity. These tables must consist of foreign keys taken from the two entity tables. [There is no need] (http://weblogs.sqlteam.com/jeffs/archive/2007/08/23/composite_primary_keys.aspx) to create a separate primary key based on this (though some developers do) as the two foreign keys in combination serve this purpose. The table is never referenced in isolation so the use of a separate 'id' field is somewhat redundant.