Table Naming: Underscore vs Camelcase? namespaces? Singular vs Plural?
I've been reading a couple of questions/answers on StackOverflow trying to find the 'best', or should I say must accepted way, to name tables on a Database.
Most of the developers tend to name the tables depending on the language that requires the database (JAVA, .NET, PHP, etc). However I just feel this isn't right.
The way I've been naming tables till now is doing something like:
doctorsMain
doctorsProfiles
doctorsPatients
patientsMain
patientsProfiles
patientsAntecedents
The things I'm concerned are:
- Legibility
- Quick identifying of the module the table is from (doctors||patients)
- Easy to understand, to prevent confusions.
I would like to read any opinions regarding naming conventions. Thank you.
Solution 1:
Being consistent is far more important than what particular scheme you use.
Solution 2:
I typically use PascalCase and the entities are singular:
DoctorMain
DoctorProfile
DoctorPatient
It mimics the naming conventions for classes in my application keeping everything pretty neat, clean, consistent, and easy to understand for everybody.
Solution 3:
Case insensitive nature of SQL supports Underscores_Scheme
. Modern software however supports any kind of naming scheme. However sometimes some nasty bugs, errors or human factor can lead to UPPERCASINGEVERYTHING
so that those, who selected both Pascal_Case
and Underscore_Case
scheme live with all their nerves in good place.