Also, is it done automatically in some environments?
-
It's entirely optional, but some tools (MySQL Workbench and SQLDeveloper IIRC) will auto-complete with capitals. It simply helps to make your code more readable - just like English (and most other languages). Your question isn't really a good fit for this site - it's not really a DBA question. – Vérace Jul 13 '15 at 01:42
1 Answers
The SQL language is not case sensitive. It is not important whether you type select or SELECT.
Often rules about capitalisation are included in a company's or project's coding standards. These often dictate where indentation, alignment and white space should be used, too. This is important because it adds uniformity across all the code. After a short while your eyes get used to the layout and can scan the code much more quickly, identifying important clauses and missing constructs.
Exactly where white space, alignment and capitalisation should be applied is a subject of active debate. Every programmer I've ever worked with had their own idea. There is no universally correct answer. The value lies in uniformity, not the individual choices.
Some years ago colleagues were working on a project where the database was declared with a case sensitive collation. Then they did have to be careful about capitalisation as key words or variables were considered different, much like Java.
- 24,839
- 13
- 51
- 96