My t-sql teacher told us that naming our PK column Id is considered bad practice without any further explanations. Why is naming a table PK column Id is considered bad practice?
Why is naming a table's Primary Key column Id considered bad practice?
sql;naming;tsql
I'm going to come out and say it: It's not really a bad practice (and even if it is, its not that bad).You could make the argument (as Chad pointed out) that it can mask errors like in the following query:SELECT *     FROM cars car    JOIN manufacturer mfg        ON mfg.Id = car.ManufacturerId    JOIN models mod        ON mod.Id = car.ModelId    JOIN colors col        ON mfg.Id = car.ColorIdbut this can easily be mitigated by not using tiny aliases for your table names:SELECT *     FROM cars    JOIN manufacturer        ON manufacturer.Id = cars.ManufacturerId    JOIN models        ON models.Id = cars.ModelId    JOIN colors        ON manufacturer.Id = cars.ColorIdThe practice of ALWAYS using 3 letter abbreviations seems much worse to me than using the column name id. (Case in point: who would actually abbreviate the table name cars with the abbreviation car? What end does that serve?)The point is: be consistent. If your company uses Id and you commonly make the error above, then get in the habit of using full table names. If your company bans the Id column, take it in stride and use whatever naming convention they prefer.Focus on learning things that are ACTUALLY bad practices (such as multiple nested correlated sub queries) rather than mulling over issues like this. The issue of naming your columns ID is closer to being a matter of taste than it is to being a bad practice.A NOTE TO EDITORS : The error in this query is intentional and is being used to make a point. Please read the full answer before editing.