SQL TABLE naming. persons vs. people
I'm looking to create a new TABLE in my database but ran into a naming conundrum. I initially wanted to create the table as people
But then I got to thinking... should I name the table people or persons
TABLE CREATE persons(name string, age integer) or TABLE CREATE people(name string, age integer)
The words people and persons can both be used as the plural of person,People is by far the more common of the two words and is used in most ordinary contexts: "a group of people"; "there were only about ten people"
if you are going to have particular person's detail [attributes of individuals ] as name, age... then I think you should go with "persons'
TABLE CREATE persons(name string, age integer)
if you would have fields in the table like People_count ,Avg_Age , Totalvote etc , then you should have choose table name "People"
The correct plural of person when talking about a collective group is people; unless talking in legal terms, which generally refers to first, second, and third persons or specifying individuals. (See here: http://english.stackexchange.com/questions/46294/correct-usage-of-persons-vs-people for more)
Because they are in the same table, they follow a normalized form, which suggests they are a collective group, thus use people.
This gets into a larger question about nomenclature, which the general rule is to be consistent. When it comes to database schemas, I generally pluralized the table names and then use a singular alias in the SQL — it's more work, but easier to read, for instance:
SELECT person.first_name, person.last_name FROM people person WHERE person.age > 18
This is debated and often considered a matter of opinion, however I recommend always using singular. Your table name should be 'Person'.
- A table should be named the 'object' of what it contains. Plural is 'redundant', the table may always have 0, 1 or more items in it, using a singular reference standardises this across the board.
- You can think of a table as an object - a 'container' of something. For example if you have a Box of Mushrooms, then it is a 'MushroomBox', it doesn't make sense to call it a 'MushroomBoxes'. Whether it has 0, 1, or many mushrooms in it, it's always a 'MushroomBox'.
- Plural names can have more irregularities and complexities such as "ies", "es" vs "s" or words such as "Status" and "Mice" vs "Mouse" etc. Singular is simpler, easier and more consistent.
- If you have related tables, a singular naming convention carries over better. Say you have one table 'Student' and another Table 'Room'. You could potentially have a 'StudentRoom' table. But the name 'StudentsRoom' or 'StudentsRooms' is confusing.
- When you refer to a column within a table, singular makes sense. Take the following example: SELECT * FROM Person WHERE Person.FirstName = 'John' makes more sense than SELECT * FROM Persons where Persons.Firstname = 'John' because you are talking about "a row", or "a person".
- Singular uses less characters :)