mirror of
https://github.com/treffynnon/sqlstyle.guide.git
synced 2025-03-09 12:49:51 -05:00
Add in some licence information
This commit is contained in:
parent
55c9d6485e
commit
7cae26db5b
5 changed files with 70 additions and 5 deletions
7
LICENCE
Normal file
7
LICENCE
Normal file
|
@ -0,0 +1,7 @@
|
|||
SQL style guide (c) by Simon Holywell <https://www.simonholywell.com/>
|
||||
|
||||
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 <http://creativecommons.org/licenses/by-sa/4.0/>.
|
|
@ -1,3 +1,7 @@
|
|||
<footer class="foot">
|
||||
<p>© Copyright Simon Holywell 2015</p>
|
||||
|
||||
<p>
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">SQL style guide</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://www.simonholywell.com" property="cc:attributionName" rel="cc:attributionURL">Simon Holywell</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="http://www.sqlstyle.guide" rel="dct:source">http://www.sqlstyle.guide</a>.
|
||||
</p>
|
||||
</footer>
|
|
@ -4,5 +4,8 @@
|
|||
<header class="top">
|
||||
<div class="wrap">
|
||||
<h1>SQL Style Guide</h1>
|
||||
<p class="author">by <a href="https://www.simonholywell.com">Simon Holywell</a></p>
|
||||
<p class="twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.sqlstyle.guide" data-text="SQL style guide by @treffynnon" data-size="large" data-dnt="true">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
|
||||
</div>
|
||||
</header>
|
|
@ -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"
|
||||
"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"
|
21
style.css
21
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 {
|
||||
|
|
Loading…
Reference in a new issue