Let's say I need a simple table with an account ID and no other information. There are two ways to do this:
id varchar(255) PRIMARY KEY
Or add a numeric primary key:
id int PRIMARY KEY accountId varchar(255) UNIQUE NOT NULL
What are the advantages / disadvantages of both approaches and which ones would you choose and why?
What are the implications of the first solution for maintainability (what if we need to change the identifier for one row) and for performance?
database mysql database-design schema
Richard Knop
source share