Submission timeline
2007–2026One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.
First comments on top threads
HN comment orderWeird, I really dislike a lot of the suggestions. In particular, an example: SELECT first_name AS fn FROM staff AS s1 JOIN students AS s2 ON s2.mentor_id = s1.staff_num; We already agreed that staff is a good name for a table, so why are we renaming it to s1? There are all sorts of subtle bugs that arise when s2.mentor_id = s1.staff_num is wrong, and the variable names provide no help here that we're doing things right. How about: SELECT…
Familiarity makes consistency the only real guide in any formatting guide. So, apart from formatting rules, there are still a few bits to argue about. Try to use only standard SQL functions instead of vendor specific functions for reasons of portability. I don't think this is too important as the many places I've worked at had been using the same vendor for many years. Depends on your future plans, I guess. Include comments in SQL code where necessary. Use the…
> Spaces should be used to line up the code so that the root keywords all end on the same character boundary. SELECT file_hash FROM file_system WHERE file_name = '.vimrc'; This style is annoying and I wish it gained less traction. It looks neat but it puts so much burden on the query writer, especially when you modify the query and all of the sudden you need to indent multiple lines just to make them all align. You know what's…
"Use a collective name or, less ideally, a plural form. For example (in order of preference) staff and employees." I hope Simon Holywell has never had to model a zoo in SQL. "Where are the rattlesnakes Simon - are they in the rhumba, crash or knot table?" [1] [1] http://blog.writeathome.com/index.php/2013/03/improved-anima...
The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.
- Breakout years
- 2
- Total points
- 391
- Total comments
- 240
100+ points or 50+ comments
reference only — not used in Hall rules or ranking
reference only — not used in Hall rules or ranking
Every submission
| Date | Title as submitted | By | Points | Comments |
|---|---|---|---|---|
| 2015-07-24 | SQL style guide – a consistent code guide ensuring legible and maintainable code | Treffynnon | 16 | 10 |
| 2016-10-09 | SQL style guideFirst breakout · Best thread | okket | 257 | 146 |
| 2018-09-06 | SQL Style Guide | ainar-g | 59 | 16 |
| 2020-07-29 | A Style Guide for SQL | jerodsanto | 3 | 0 |
| 2024-11-15 | SQL style guide by Simon HolywellHall induction · Latest 20+ point return | thunderbong | 56 | 68 |
