4 ms·
Still dont get why sql uses all caps for keywords. It's one of the few languages that has it as a best practice. I can read C/JavaScript/go just fine without al
by mmgutz 10y ago
Still dont get why sql uses all caps for keywords. It's one of the few languages that has it as a best practice. I can read C/JavaScript/go just fine without all caps.
I do it anyway to conform.
- collyw 10y agoThere are relatively few keywords in SQL, and I think it makes them distinct from user named parts of the query.
- VLM 10y agoYou can ignore the boilerplate if its in CAPS. Quite a few DB engines enforce as a syntax error a SELECT that isn't in the precise order of FROM WHERE GROUP HAVING ORDER LIMIT (plus some others depending on your DB). You and I understand what we mean if we write LIMIT 10 SELECT * FROM wtf but many DB engines will be unhappy because LIMIT has to be after FROM, etc. Once you're used to the strict order rules, you can skip reading anything in CAPS as long as the bug you're fixing isn't that they're myspeled or order out of.
- barrkel 10y agoPersonally I don't care either way, but I like it to be consistent for any given sequence SQL in a file (SQL is usually embedded in some other language's quoting mechanism). If everything is lowercase, you can tune in to spotting the keywords. If it's mixed, it's just confusing. There's an argument to be made that because SQL is so often quoted in a different language, highlighting isn't often applied.
- jackmaney 10y agoAgreed. Every time I write SQL with keywords in all caps, I feel like I'm screaming at the query parser.
- wvenable 10y agoI used to use all caps for keywords before the invention of syntax highlighting. Now my keywords are highlighted in another color just as they are in every other language so I no longer all-caps them.
- userbinator 10y agoI have a feeling it may be related to increasing its COBOL-ness. Both are languages that were designed to be "human-readable".
- HNSucksAss 10y agoAnd yet you misspelled "SQL."