MySQL Forums
Forum List  »  Newbie

Re: Sakila database, film_actor table. How do we order them?
Posted by: Peter Brawley
Date: August 15, 2022 12:04PM

> So what is better?

Beginners often like composite keys because they seem to be appealingly self-documenting. But that appeal often turns out to be illusory and/or inconvenient.

Often a surrogate key is the simplest and most reliable solution. But not always.

Fact is, there's not a universal rule---the choice depends on all aspects of the requirement that apply to the table, its keys and relationships.

So, PK design depends on writing and testing an exhaustive requirement document, as described for example at https://www.artfulsoftware.com/dbdesignbasics.html. Late in that process, you write and test all input and select queries that involve the table; that will reveal what keys you need.



Edited 1 time(s). Last edit at 08/15/2022 12:07PM by Peter Brawley.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.