Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I am currently working in a project that uses sql server as backend.

I worked with different databases like Oracle, Mysql and Postgres as well.

I created database in Sql Server and created table and its columns with underscore and all lower case.

plan_master (table)
(
plan_master_id (pk)
plan_name
)

plan_ detail (table)
(
plan_detail_id (pk)
plan_master_id (fk)
effective_ date
)

Since this practice I have seen in Mysql, Postgres and Oracle as well.

Now our client come into the picture and said that this is wrong practice. The correct way of table and column naming convension is having pascal case without underscore.

For ex.

PlanMaster (table)
(
PlanMasterId (pk)
PlanName
)

PlanDetail (table)
(
PlanDetailId (pk)
PlanMasterId (fk)
EffectiveDate
)

Please advice which is correct practice and why.

If our practice is incorrect for sql server then I have to rename almost 80 tables and its columns and its huge impact on already developed c# code.

What I have tried:

I created a function in database that will return the pascal case name.
Posted
Updated 30-Jan-20 17:01pm
v2

Neither is incorrect; it is all a matter of preference and opinion. I personally prefer their naming convention, and save the underscored names for for bridge/matrix tables and for stored procedures.

As for the client; it comes down to what was specified in the contract, if they had to approve the naming convention then it is on you to meet that specification. If it is not mentioned, then you need to let them know that and that there will be a delay for the rework that is needed
 
Share this answer
 
Comments
Patrice T 4-Feb-20 20:00pm    
Agreed +5
I agree with MadMyche, this is mainly a preference so unless the contract specifies which standard to use or let's the customer specify it, then both are correct. Personally I use Pascal casing without underscores at all, but as said, that's my preference.

After all the main things are distinctness and readability. These are partially achieved with naming but a more important role is played by the documentation. If the documentation is done well for both server and client side, the details of the naming used, such as Pascal case or underscores, become almost meaningless. Of course the naming has to be descriptive but in both of your examples, I believe this is the case.

One thing to still take into account is the case sensitivity. If the database is case insensitive, you can still query using upper or lower case characters in the object names.
 
Share this answer
 
Comments
MadMyche 31-Jan-20 7:21am    
Thank you for your agreement
Patrice T 4-Feb-20 20:00pm    
Agreed +5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900