diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..336bdb9 --- /dev/null +++ b/LICENCE @@ -0,0 +1,7 @@ +SQL style guide (c) by Simon Holywell + +SQL style guide is licensed under a +Creative Commons Attribution-ShareAlike 4.0 International License. + +You should have received a copy of the license along with this +work. If not, see . \ No newline at end of file diff --git a/_includes/foot.html b/_includes/foot.html index 06841cd..34b6442 100644 --- a/_includes/foot.html +++ b/_includes/foot.html @@ -1,3 +1,7 @@ \ No newline at end of file diff --git a/_includes/head.html b/_includes/head.html index f25db9f..c905eac 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -4,5 +4,8 @@

SQL Style Guide

+

by Simon Holywell

+
\ No newline at end of file diff --git a/_includes/sqlstyle.guide.md b/_includes/sqlstyle.guide.md index a0e2888..66c0c80 100644 --- a/_includes/sqlstyle.guide.md +++ b/_includes/sqlstyle.guide.md @@ -12,9 +12,13 @@ easier. This guide is a little more opinionated in some areas and in others a little more relaxed. It is certainly more succinct where [Celko's book][celko] contains anecdotes and reasoning behind each rule as thoughtful prose. -You can easily include this guide in [Markdown format][dl-md] as a part of a +It is easy to include this guide in [Markdown format][dl-md] as a part of a project's code base or reference it here for anyone on the project to freely -read—much harder with a physical book! +read—much harder with a physical book + +SQL style guide by [Simon Holywell][simon] is licensed under a [Creative Commons +Attribution-ShareAlike 4.0 International License][licence]. +Based on a work at [http://www.sqlstyle.guide][self]. ## General @@ -44,8 +48,16 @@ read—much harder with a physical book! structures. ```sql -SELECT first_name - FROM staff; +SELECT file_hash, -- stored ssdeep hash + FROM file_system + WHERE file_name = '.vimrc'; +``` +```sql +/* Updating the file record after writing to the file */ +UPDATE file_system + SET file_modified_date = '1980-02-22 13:19:01.00000', + file_size = 209732 + WHERE file_name = '.vimrc'; ``` ## Naming conventions @@ -206,6 +218,18 @@ Keeping all the keywords aligned to the righthand side and the values left align creates a uniform gap down the middle of query. It makes it much easier to scan the query definition over quickly too. +```sql +INSERT INTO albums (title, release_date, recording_date) +VALUES ('Charcoal Lane', '1990-01-01 01:01:01.00000', '1990-01-01 01:01:01.00000'), + ('The New Danger', '2008-01-01 01:01:01.00000', '1990-01-01 01:01:01.00000'); +``` + +```sql +UPDATE albums + SET release_date = '1990-01-01 01:01:01.00000' + WHERE title = 'The New Danger'; +``` + ```sql SELECT a.title, a.release_date, a.recording_date, a.production_date -- grouped dates together @@ -1225,6 +1249,8 @@ ZEROFILL ZONE ``` +[simon]: https://www.simonholywell.com/ + "SimonHolywell.com" [issue]: # [fork]: # [pull]: # @@ -1239,4 +1265,8 @@ ZONE [reserved-keywords]: #reserved-keyword-reference "Reserved keyword reference" [eav]: https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model - "Wikipedia: Entity–attribute–value model" \ No newline at end of file + "Wikipedia: Entity–attribute–value model" +[self]: http://www.sqlstyle.guide + "SQL style guide by Simon Holywell" +[licence]: http://creativecommons.org/licenses/by-sa/4.0/ + "Creative Commons Attribution-ShareAlike 4.0 International License" \ No newline at end of file diff --git a/style.css b/style.css index a101f38..9a3802e 100644 --- a/style.css +++ b/style.css @@ -85,10 +85,31 @@ a:hover { header.top { background: {{ primary_colour }}; + color: #333; } header.top h1 { color: #fff; + margin-bottom: 0; +} + +header.top p.author { + margin-top: 0; +} + +header.top a { + color: #333; + border-color: #333; +} + +header.top a:hover { + border: none; + text-decoration: none; +} + +header.top p.twitter { + float: right; + margin-top: -3em; } .wrap {