DEV Community

Discussion on: Primary Keys in SQL

Collapse
 
alvaromontoro profile image
Alvaro Montoro

Nice introduction to primary keys.

As a side note: I would update the example at the beginning. The fact that you can change your twitter handle (even if it has to be unique) is a sign that it is a bad candidate for a primary key. Imagine that you use it as a primary key, and then the user changes it. It would require a major update all over the database. It would be better to have a different field as primary key, and have the twitter handle with an unique constraint.