Table Name Conventions/Standards

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
zenabi
Forum Commoner
Posts: 84
Joined: Mon Sep 08, 2003 5:26 am
Location: UK

Table Name Conventions/Standards

Post by zenabi »

This isn't overly important, but is it recommended to have tables named in a singular or plural manner?

Eg.

Code: Select all

SELECT * FROM user
or

Code: Select all

SELECT * FROM users
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It's totally up to you, I tend to use plurals for the table name and then singulars for fields but that's just because I like it that way.

Mac
evilMind
Forum Contributor
Posts: 145
Joined: Fri Sep 19, 2003 10:09 am
Location: Earth

Post by evilMind »

It makes more sense to have a table called "users" which will store multiple users (instead of user which makes it seem like there is only one 'user'). Just as it would make more sense to have a table named 'cars' which would hold information about many 'cars' not just one. As mentioned earlier, it's really up to you; however, it makes more sense to stick with what twigletmac posted.
Post Reply