mysql primary key id debate

Wade Preston Shearer lists at wadeshearer.com
Thu Dec 29 16:14:59 MST 2005


> Myself and three other programers have been arguing (for well over  
> an hour)
> about naming the primary key in a mysql database table.
> I was wondering what other people name it.
>
> The argument is to name it "id" or another name like "client_id".
> I like client_id because then the primary key name matches the  
> foreign key
> in another table.
>
> My coworker likes just the name id because then he can have a base  
> class
> called getId() that returns the value of the id column of that table.

Every database that I have ever created has had more than one ID  
(client ID, employee ID, product ID, group ID, etc). I would find it  
very confusing to not have unique keys across the entire database.



More information about the PLUG mailing list