Why should I use this:

alter table `user` add column `first_name`;

Instead of this:

alter table `user` add column `first name`;
  • 3
    Because you can skip using the awful backticks? – ypercubeᵀᴹ Feb 14 '15 at 15:00
  • 1
    And because when you have white space in entity names, there is a trickle-down effect where all code that references that table must have special handling for those column names. What do you GAIN by having a space instead of _? Does not having to press the shift key for that keystroke improve your productivity? – Aaron Bertrand Feb 14 '15 at 15:42
  • @AaronBertrand I'm not stating that one is better over the other. I guess you answered the question, if there's no other convention or things that could possibly cause errors. – oddRaven Feb 14 '15 at 15:54
  • @ypercube I like to be consistent in case I ever use a table called 'table' or something. – oddRaven Feb 14 '15 at 15:56
  • Internally, column names are just strings. Table names and database names, however, show up in the OS in file names and directory names -- this could lead to some 'tricke-down' effects. – Rick James Feb 14 '15 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.