Why are columns ID and name not allowed in dB?

Why are columns ID and name not allowed in dB?

This is a very powerful thing. Usually an OO software is built on top of the database, but the OO toolset cannot be applied because the db itself does not allow it. Having the columns id and name is still not very good, but it is a step. Why cant I do this?

How are table and column names in a database?

I wouldn’t rely on Microsoft for any standard – if you look at their northwind database you’ll see they use Plural Tables, Singular Column Names, Schema Prefixes for Tables, Table Prefixes for Primary Key Columns, Hungarian-esque Constraint Prefixes and worst of all SPACES ” ” for multi-word table names.

When to use a naming convention in a database?

You’ll apply these rules while naming anything inside the database – tables, columns, primary and foreign keys, stored procedures, functions, views, etc. Of course, you could decide to only set naming convention rules for tables and column names. That part is completely up to you. Also, using the naming convention is not the rule, but it’s desired.

Why do all tables have the same ID field name?

That way all tables have a the same name for the id field and there isn’t a redundant description. This seems simpler to me because all the tables have the same primary key field name. As far as joining tables and not knowing which Id field belongs to which table, in my opinion the query should be written to handle this situation.

Which is the correct name for the ID column?

If you use tablenameID as the id field, this kind of accidental mistake is far less likely to happen and much easier to find. I always prefered ID to TableName + ID for the id column and then TableName + ID for a foreign key.

Why do you use PK for ID columns in SQL?

Using the standard naming convention of Id the the PK allows for inheritance of a base poco class with validation and such for tables which share a set of common column names. Using the Tablename + Id as the PK for each of these tables destroys the ability to use a base class for these. Just some food for thought.

Can a + 1 column have the same name as a foreign key column?

+1 Columns that are synonymous should have the same name – by using the table name prefix you can have a primary key column called table1ID and a foreign key column in another table called table1ID – and you KNOW that they are the same thing.