
Naming Database Tables: Is It Person, Peoples, Persons or People? - ed_elliott_asc
https://the.agilesql.club/2019/05/should-i-pluralize-table-names-is-it-person-persons-people-or-people/?ut=hn
======
JohnFen
I don't think whether the names are plural or not actually matters. What
matters is that a style is chosen and used consistently.

~~~
ed_elliott_asc
Consistency is king :)

------
quizotic
The only problem with singular nouns for table names is that they occasionally
conflict with SQL keywords. The canonical example of this is from the TPC-H
benchmark which has tables named REGION, NATION, SUPPLIER, CUSTOMER, PART,
PARTSUPP, LINEITEM ... AND ORDERS <\- plural because ORDER is a SQL keyword.

I like the singular guidance for all the reasons given. I like the consistency
guidance. But the real world sometimes gets in the way.

~~~
ed_elliott_asc
true but using [] fixes that, and they can be added by tooling

------
teddyuk
The thing that I get annoyed by is when the columns don't match the table
names so something like:

create table people(person_id int)

This literally drives me to distraction and I want to throw my computer out of
the window :)

~~~
pmontra
According to my CS professor it's

    
    
      create table person(id int)
    

According to Rails it's

    
    
      create table people(id int)
    

Both agree on how to name the primary key. Person_id would be redundant.

~~~
ed_elliott_asc
I prefer person and person_id because when joining to to other tables it is
easier (in my head) to join person_id to person_id than person_id to id

~~~
Nicksil
Have you tried creating an alias in your statement(s)? Using `AS` to make this
explicit may further help. Just a suggestion.

~~~
ed_elliott_asc
yes but it is still an akwardness i prefer to avoid by using tablename_id like
you'd have to do something like

"select id as tablename_id, * from table"

just doesn't feel quite right to me personally

------
warpspin
The hardest thing in IT is naming things :D

------
dekhn
it's a people table with person ids.

------
combatentropy
How do you name:

\- an API endpoint

\- an array

\- a computer folder

\- a paper folder

~~~
aitchnyu
Not just api endpoints, what about URLs which are used by laypeople without
English fluency?

