Column name naming conventions and best practices
21
votes
3
answers
9781
views
I would like some expert opinion on best practices when it comes to **column naming**.
The background is that [according to Wikipedia](http://en.wikipedia.org/wiki/Join_(SQL)#Equi-join) , the following syntax,
SELECT ... FROM Employees JOIN Timesheets USING (EmployeeID);
is more efficient than
SELECT ... FROM Employees JOIN Timesheets ON (Employees.EmployeeID = Timesheets.EmployeeID);
However, the
JOIN ... USING
syntax only works of *all primary key columns have globally unique names*. Thus I wonder if this is considered The Right Thing to do.
Personally, I always used to create tables with PK column id
, and foreign key column othertable_id
. But that way it's not possible to use USING
or NATURAL JOIN
.
Any links to design styles or best practice guides for table design would be appreciated, too!
Asked by Kerrek SB
(313 rep)
Jul 7, 2011, 03:28 AM
Last activity: Jun 12, 2024, 07:11 PM
Last activity: Jun 12, 2024, 07:11 PM