What is the most common naming convention for SQL Database tables? Was it historically one way and now it's better to do another way? What are the most common practices now?
So Which Should I Use: Singular or Plural? The correct answer is that there is no right or wrong when naming database tables — just be consistent from the start. The only wrong answer with database table names is to use a combination of plural and singular.
The plural form of table; more than one (kind of) table.
The defined standard is to go for non-plural because in a table we are storing a set of an entity and we name the table as the entity so if we want to store one or more people in a single entity or table, we store it or them in the “Person” table.
The plural form of database is databases. Find more words!
I always use plural for table names and singular for column names. Not that there's any real technical reason for it, that's just what I prefer.
Doesn't much matter, so long as you are consistent.
I.e.
+========+ +==========+ | Posts | | Users | +--------+ +----------+ | idPost | |-> | idUser | | Poster | <-| | Name | +========+ +==========+
My reasoning for this is what happens when you write the actual query:
SELECT idPost, Name FROM Posts
INNER JOIN Users ON Poster = idUser
If you use singular, it looks like you're selecting from a post, rather than from the set of all posts, and joining to a single user, instead of all users.
Nope - singular for me. It's the "USER" table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With