1
0
Fork 0
mirror of https://github.com/treffynnon/sqlstyle.guide.git synced 2025-03-09 12:49:51 -05:00
This commit is contained in:
rhowe-ives 2018-03-21 12:12:54 +00:00 committed by GitHub
commit 49f2de92b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 315 additions and 9605 deletions

1
CNAME
View file

@ -1 +0,0 @@
www.sqlstyle.guide

View file

@ -1,2 +0,0 @@
source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins

353
README.md
View file

@ -1,62 +1,339 @@
# SQL style guide
**[☛ Read the guide](http://www.sqlstyle.guide)**
## Overview
---
This document is a work in progress to generate a SQL query style guide for use in our department
## General
The guide is written in [Markdown][md-lang] and uses [Jekyll][jekyll] via
[GitHub's Pages][gh-pages] facility to render itself upon pushing to the `gh-pages`
branch.
### Do
## Sources
* Use consistent and descriptive identifiers and names.
* Make judicious use of white space and indentation to make code easier to read.
* Store [ISO-8601][iso-8601] compliant time and date information
(`YYYY-MM-DD HH:MM:SS.SSSSS`).
* Try to use only standard SQL functions instead of vendor specific functions for
reasons of portability.
* Keep code succinct and devoid of redundant SQL—such as unnecessary quoting or
parentheses or `WHERE` clauses that can otherwise be derived.
* Include comments in SQL code where necessary. Use the C style opening `/*` and
closing `*/` where possible otherwise precede comments with `--` and finish
them with a new line.
The markdown source for the guide can be found in [_includes/sqlstyle.guide.md][md]
```sql
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';
```
## Installing for local development
### Avoid
There is a Gemfile supplied so you just need to follow the
[GitHub Pages documentation][gh-pages-help] to install the dependencies.
* Object oriented design principles should not be applied to SQL or database
structures.
To then run it locally `bundle exec jekyll serve`
## Naming conventions
## Translations of the guide
### All Naming Conventions
* See Confluence documentation for [Ives Database Design Guide][design-guide] when creating new tables or altering existing tables for the complete naming conventions to be used.
If you would like to translate the guide then please open a pull request or open an issue
if you need some help getting it setup.
### Aliasing or correlations
* [German/Deutsch](http://www.sqlstyle.guide/de/) by [AStasyK](https://github.com/AStasyK)
* [Japanese/日本語](http://www.sqlstyle.guide/ja/) by [nkurigit](https://github.com/nkurigit)
* [Portuguese (Brazil)/Português (BR)](http://www.sqlstyle.guide/pt-br/) by [pmarcus93](https://github.com/pmarcus93)
* [Russian/Русский](http://www.sqlstyle.guide/ru/) by [denpatin](https://github.com/denpatin)
* [Simplified Chinese/简体中文](http://www.sqlstyle.guide/zh/) by [wontoncoder](https://github.com/wontoncoder)
* [Traditional Chinese/正體中文](http://www.sqlstyle.guide/zh-tw/) by [Leon0824](https://github.com/Leon0824)
#### Aliasing Column Names
* Avoid unnecessary aliases at all times
* Must always alias `COUNT(*)` columns
* Must always alias computed data (`SUM()` or `AVG()` or `IF()`). Use the name you would give it were it a column defined in the schema.
* Must always include the `AS` keyword, which makes it easier to read since it is explicit.
* Should relate in some way to the object or expression they are aliasing.
## Projects known to be implementing the guide
#### Aliasing Table Names
* All Tables must be aliased when using more than one in a JOIN
* Table aliases will be made up of the first letter of every word in the table name unless
* unless the alias is a reseverd word ie. `FROM INTERNATIONAL_FILINGS AS IF` will cause an error in SQL
* in this case us an abbreviated name for the table ie. `FROM INTERNATIONAL_FILINGS AS IFILINGS`
* if the aliases for two tables will be the same, or the same table is used more than once, append a number in order of apperance in the query
* When a query contains multiple databases the first letter of the database, in lower case will be prepended to the table alias ie. `FROM international.ENTITY_MAP AS iEM INNER JOIN secdocs.COMPANY AS sC`
If your project uses this styleguide and you'd like to be mentioned in this readme then
please open a pull request adding it below in alphabetical order with a URL and short
description.
```sql
SELECT
COUNT(*) as student_staff_count
FROM
STAFF AS S1
INNER JOIN
STUDENTS AS S2
ON S2.mentor_id = S1.staff_num;
```
```sql
SELECT
SUM(s.monitor_tally) AS monitor_total
FROM
STAFF AS S
GROUP BY
S.staff_department_fkey;
```
* [BEdita](https://github.com/bedita/bedita) - a Symfony based PHP CMF
* [SQLQuery.jl](https://github.com/yeesian/SQLQuery.jl) - A Julia lang package for representing sql queries, and converting them to valid SQL statements
* [Stock Talk](https://github.com/nigelgilbert/stock-talk) - a realtime dashboard that displays the stock data of the most Tweeted Nasdaq companies.
### Uniform suffixes
## Notable forks of the guide
The following suffixes have a universal meaning ensuring the columns can be read
and understood easily from SQL code. Use the correct suffix where appropriate.
These are based on, but deviate in some way from sqlstyle.guide.
* `_key`—a unique identifier such as a column that is a primary key.
* `_status`—flag value or some other status of any type such as `publication_status`.
* `_total`—the total or sum of a collection of values.
* `_num`—denotes the field contains any kind of number.
* `_name`—signifies a name such as `first_name`.
* `_date`—denotes a column that contains the date of something.
* `_count`—a count.
If you have forked this styleguide and you'd like to be mentioned in this readme then
please open a pull request adding it below in alphabetical order with a URL and short
description of your deviance.
## Query syntax
* [Lumos Labs](https://github.com/lumoslabs/sqlstyle.guide) - removed the river, Redshift, etc. [www](http://engineering.lumosity.com/sqlstyle.guide)
### Reserved words
Always use uppercase for the [reserved keywords][reserved-keywords] like `SELECT`, `WHERE` or `IF`.
Data manipulation statements should have every clause keyword on a line of its own unless performing extremely simple statements. Examples of the clause keywords are `SELECT`, `DELETE`, `UPDATE`, `FROM`, `WHERE`, `HAVING`, `GROUP BY`, `ORDER BY`, `LIMIT`. An example of a simple single line statements `SELECT COUNT(*) as student_count FROM STUDENTS WHERE graduated = 0;`
### White space
To make the code easier to read it is important that the correct compliment of
spacing is used. Do not crowd code or remove natural language spaces.
#### Spaces
Spaces should never be used to line up the code so that the root keywords all end on the same character boundary.
* Indentations of 4 spaces are the standard that is utilized throughout the codebase.
* All `(` and `)` must be placed on a line of there own unless only operating on two or less items
```sql
(
SELECT
species_name,
AVG(height) AS average_height,
AVG(diameter) AS average_diameter
FROM
FLORA
WHERE
species_name = 'Banksia'
OR
species_name = 'Sheoak'
OR
species_name = 'Wattle'
GROUP BY
species_name,
observation_date
)
UNION ALL
(
SELECT
species_name,
AVG(height) AS average_height,
AVG(diameter) AS average_diameter
FROM
BOTANIC_GARDEN_FLORA
WHERE
species_name = 'Banksia'
OR
species_name = 'Sheoak'
OR
species_name = 'Wattle'
GROUP BY
species_name,
observation_date
)
```
Although not exhaustive always include spaces:
* before and after equals (`=`)
* after commas (`,`)
* surrounding apostrophes (`'`) where not within parentheses or with a trailing
comma or semicolon.
```sql
SELECT
title,
release_date,
recording_date
FROM
ALBUMS
WHERE
title = 'Charcoal Lane'
OR
title = 'The New Danger';
```
#### Line spacing
Always include newlines/vertical space:
* after semicolons to separate queries for easier reading
* after each `VALUE` group in an `INSERT` statement
* to separate code into related sections, which helps to ease the readability of large chunks of code.
Always on their own line:
* Data manipulation statements should have every clause keyword on a line of its own unless performing extremely simple statements. Examples of the clause keywords are `SELECT`, `DELETE`, `UPDATE`, `FROM`, `WHERE`, `HAVING`, `GROUP BY`, `ORDER BY`, `LIMIT`. An example of a simple single line statements `SELECT COUNT(*) as student_count FROM STUDENTS WHERE graduated = 0;`
* Every field being selected, updated, grouped on or limted by in the query should be on their own line. Unless involved in a functional operation such as an `IF()`, `CASE`, `COALESCE()` ... etc. which require additional fields to function
* `AND` and `OR` should appear on their own lines
[md-lang]: http://daringfireball.net/projects/markdown/
[jekyll]: http://jekyllrb.com/
[gh-pages]: https://pages.github.com/
[md]: https://github.com/treffynnon/sqlstyle.guide/blob/gh-pages/_includes/sqlstyle.guide.md
[gh-pages-help]: https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/
```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',
producer_name = NULL
WHERE
title = 'The New Danger';
```
```sql
SELECT
title,
release_date,
recording_date,
production_date
FROM
ALBUMS
WHERE
title = 'Charcoal Lane'
OR
title = 'The New Danger';
```
### Indentation
To ensure that SQL is readable it is important that standards of indentation
are followed.
#### Clause Keywords
* Should be at the top level with the least indentation of anything else contained in their statement.
* These words should be on a line alone
#### Joins
* Natural Joins are not allowed ... ever
* A Join type must be indicated `LEFT OUTER`, `RIGHT OUTER`, `INNER`
* Joins should be indented one indent under their tables or sub-queries
* ON clauses should be indented to be left justified with the JOINs
* Multiple ON clauses should be indented to be vertically aligned with the ON and JOIN keywords
```sql
SELECT
R.last_name
FROM
RIDERS AS R
INNER JOIN
BIKES AS B
ON R.bike_vin_num = B.vin_num
AND
B.engines > 2
INNER JOIN
CREW AS C
ON R.crew_chief_last_name = C.last_name
AND
C.chief = 'Y';
```
#### Subqueries
Subqueries should be aligned with the indentation level that their non-subquery counterpart would reside. Subqueries should begin with a line containing only an opening `(` then the next line being indented 1 indent deeper. The subquery should end with a closing `)` and the alias for that subquery if appropriate. Try and include a commend line to describe the subquery
```sql
SELECT
r.last_name,
(
SELECT
MAX(YEAR(championship_date))
FROM
champions AS c
WHERE
c.last_name = r.last_name
AND
c.confirmed = 'Y'
) AS last_championship_year
FROM
riders AS r
WHERE
r.last_name IN
(
SELECT
c.last_name
FROM
champions AS c
WHERE
YEAR(championship_date) > '2008'
AND
c.confirmed = 'Y'
);
```
### Preferred formalisms
* Make use of `BETWEEN` where possible instead of combining multiple statements
with `AND`.
* Similarly use `IN()` instead of multiple `OR` clauses.
* Where a value needs to be interpreted before leaving the database use the `CASE`
expression. `CASE` statements can be nested to form more complex logical structures.
* Avoid the use of `UNION` clauses and temporary tables where possible. If the schema can be optimised to remove the reliance on these features then it most likely should be.
```sql
SELECT
CASE postcode
WHEN 'BN1' THEN 'Brighton'
WHEN 'EH1' THEN 'Edinburgh'
END AS city
FROM
OFFICE_LOCATIONS
WHERE
country = 'United Kingdom'
AND
opening_time BETWEEN 8 AND 9
AND
postcode IN ('EH1', 'BN1', 'NN1', 'KW1')
```
[simon]: https://www.simonholywell.com/?utm_source=sqlstyle.guide&utm_medium=link&utm_campaign=md-document
"SimonHolywell.com"
[issue]: https://github.com/treffynnon/sqlstyle.guide/issues
"SQL style guide issues on GitHub"
[fork]: https://github.com/treffynnon/sqlstyle.guide/fork
"Fork SQL style guide on GitHub"
[pull]: https://github.com/treffynnon/sqlstyle.guide/pulls/
"SQL style guide pull requests on GitHub"
[celko]: https://www.amazon.com/gp/product/0120887975/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=treffynnon-20&linkId=9c88eac8cd420e979675c815771313d5
"Joe Celko's SQL Programming Style (The Morgan Kaufmann Series in Data Management Systems)"
[dl-md]: https://raw.githubusercontent.com/treffynnon/sqlstyle.guide/gh-pages/_includes/sqlstyle.guide.md
"Download the guide in Markdown format"
[iso-8601]: https://en.wikipedia.org/wiki/ISO_8601
"Wikipedia: ISO 8601"
[rivers]: http://practicaltypography.com/one-space-between-sentences.html
"Practical Typography: one space between sentences"
[reserved-keywords]: #reserved-keyword-reference
"Reserved keyword reference"
[eav]: https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model
"Wikipedia: Entityattributevalue model"
[sqlstyleguide]: 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"
[design-guide]: https://auditanalytics.atlassian.net/wiki/spaces/WEBDEV/pages/25198598/Database+Design
"Ives Database Design Guide"

View file

@ -1,46 +0,0 @@
name: SQL style guide by Simon Holywell
description: A consistent code style guide for SQL to ensure legible and maintainable projects
ga_ua_code: UA-65071829-1
url: http://www.sqlstyle.guide
domain: sqlstyle.guide
port: 4040
markdown: kramdown
permalink: pretty
highlighter: rouge
kramdown:
input: GFM
hard_wrap: false
toc_levels: "2,3"
auto_ids: true
transliterated_header_ids: true
auto_id_stripping: true
plugins:
- jekyll-redirect-from
- jekyll-sitemap
langs:
de:
de: Deutsch
en: German
en:
en: English
ja:
ja: 日本語
en: Japanese
pt-BR:
pt-BR: Português (BR)
en: Portuguese - Brazil
ru:
ru: Русский
en: Russian
zh:
zh: 简体中文
en: Simplified Chinese
zh-TW:
zh-TW: 正體中文
en: Traditional Chinese

View file

@ -1,65 +0,0 @@
<footer class="foot wrap">
<hr/>
<nav class="translation-nav">
<span>Translations:</span>
{% include layout_partials/languages.html %}
</nav>
<p>
This guide is being discussed on Hacker News [
<a href="https://news.ycombinator.com/item?id=9941150">1</a>,
<a href="https://news.ycombinator.com/item?id=12671667">2</a>
],
Reddit [
<a href="https://www.reddit.com/r/SQL/comments/3efmn0/sql_style_guide_a_consistent_code_guide_ensuring/">1</a>,
<a href="https://www.reddit.com/r/programming/comments/3eri42/sql_style_guide_by_simon_holywell/">2</a>,
<a href="https://www.reddit.com/r/PHP/comments/3efmp7/sql_style_guide_a_consistent_code_guide_ensuring/">3</a>
],
<a href="https://lobste.rs/s/q9elee/sql_style_guide_by_simon_holywell">Lobste.rs</a> and
of course <a href="https://twitter.com/search?f=tweets&amp;q=&quot;sqlstyle.guide&quot;">Twitter</a>
if you want to have your say.
</p>
<p>
I have attempted to answer most of the frequently asked questions and held misconceptions in a blog post
entitled <a href="https://www.simonholywell.com/post/2016/12/sql-style-guide-misconceptions/?utm_source={{ site.domain }}-sqlstyle.guide&amp;utm_medium=link&amp;utm_campaign=footer-link">
"SQL style guide misconceptions"</a> please have a read.
</p>
<p>Please do <a href="https://github.com/treffynnon/sqlstyle.guide/issues">open issues</a> or
<a href="https://github.com/treffynnon/sqlstyle.guide/pulls/">pull requests</a> for any errors you
may find in the guide and help me to improve it.</p>
<p>
<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/?utm_source=sqlstyle.guide-{{ site.domain }}&amp;utm_medium=link&amp;utm_campaign=footer-licence"
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 CommonsAttribution-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">www.sqlstyle.guide</a>.
</p>
<div class="buttons">
<ul class="quick-links">
<li>
<iframe class="github-btn" src="http://ghbtns.com/github-btn.html?user=treffynnon&amp;repo={{ site.domain }}&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="112px" height="20px"></iframe>
</li>
<li>
<iframe class="github-btn" src="http://ghbtns.com/github-btn.html?user=treffynnon&amp;repo={{ site.domain }}&amp;type=fork&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="98px" height="20px"></iframe>
</li>
</ul>
<ul class="quick-links">
<li class="follow-btn">
<a href="https://twitter.com/treffynnon" class="twitter-follow-button" data-link-color="#0069D6" data-show-count="true">Follow @treffynnon</a>
</li>
<li class="tweet-btn">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="{{ site.url }}" data-text="SQL style guide by @treffynnon: {{ site.description }}" data-dnt="true">Tweet</a>
</li>
</ul>
</div>
</footer>

View file

@ -1,35 +0,0 @@
<nav id="page-nav">
<a href="#" id="to-top" class="toplink"></a>
</nav>
<div id="translation-bar">
<div class="wrap">
<select class="language-drop" id="language-drop">
{% include layout_partials/languages.html dropdown=true %}
</select>
<div class="language-ico">{% include static/language.svg %}</div>
</div>
</div>
<header class="top">
<div class="wrap">
<h1 itemprop="name">{% if page.lang_title %}{{ page.lang_title }} · {% endif %}SQL Style Guide</h1>
<p class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">by
<a href="https://www.simonholywell.com/?utm_source=sqlstyle.guide-{{ site.domain }}&amp;utm_medium=link&amp;utm_campaign=header" itemprop="url"><span itemprop="name">Simon Holywell</span></a> &middot;
<a href="https://twitter.com/treffynnon">@Treffynnon</a>
</p>
<p class="twitter">
<a href="https://twitter.com/share" class="twitter-share-button"
data-url="{{ site.url }}" data-text="SQL style guide by @treffynnon: {{ site.description }}"
data-size="large" data-dnt="true">Tweet</a>
</p>
{% if page.contributors -%}
<p class="translator">Translated by:
{% for user in page.contributors -%}
<a href="https://github.com/{{ user.user }}" title="{{ user.user }} - {{ user.type }}" rel="nofollow">
{{- user.user -}}
</a>
{%- if forloop.last != true %} · {% endif -%}
{%- endfor %}
</p>
{%- endif %}
</div>
</header>

View file

@ -1,4 +0,0 @@
<option value="{{ iso }}"
{%- if page.lang == iso %} selected="selected"{% endif %}>
{{ full }}
</option>

View file

@ -1,7 +0,0 @@
<a href="{{ url }}" itemprop="availableLanguage"
itemscope itemtype="http://schema.org/Language">
<span itemprop="name" alternateName="{{ iso }}"
title="{{ full }}"
lang="{{ iso }}">{{ local }}</span>
</a>
{%- if forloop.last != true %} · {% endif -%}

View file

@ -1 +0,0 @@
<link rel="alternate" hreflang="{{ iso }}" href="{{ url }}">

View file

@ -1,21 +0,0 @@
{%- assign lpages=site.pages | where_exp:"page", "page contains 'lang'" | sort: 'lang' -%}
{%- assign content_template="layout_partials/language_nav_links.html" -%}
{%- if include.dropdown == true -%}
{%- assign content_template="layout_partials/language_dropdown_option.html" -%}
{%- endif -%}
{%- if include.rel_alternate == true -%}
{%- assign content_template="layout_partials/language_rel_alternate.html" -%}
{%- endif -%}
{% for l in lpages %}
{%- assign local=site.langs[l.lang][l.lang] -%}
{%- assign english=site.langs[l.lang]['en'] -%}
{%- assign iso=l.lang -%}
{%- assign url=l.url | absolute_url -%}
{%- capture full -%}
{{ local }}{% if l.lang_title %} ({{ english }}){% endif %}
{%- endcapture -%}
{% include {{ content_template }} %}
{% endfor %}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +0,0 @@
/*!
* AnchorJS - v1.2.1 - 2015-07-02
* https://github.com/bryanbraun/anchorjs
* Copyright (c) 2015 Bryan Braun; Licensed MIT
*/
function AnchorJS(A){"use strict";this.options=A||{},this._applyRemainingDefaultOptions=function(A){this.options.icon=this.options.hasOwnProperty("icon")?A.icon:"",this.options.visible=this.options.hasOwnProperty("visible")?A.visible:"hover",this.options.placement=this.options.hasOwnProperty("placement")?A.placement:"right",this.options.class=this.options.hasOwnProperty("class")?A.class:""},this._applyRemainingDefaultOptions(A),this.add=function(A){var e,t,o,n,i,s,a,l,r,h,c,g;if(this._applyRemainingDefaultOptions(this.options),A){if("string"!=typeof A)throw new Error("The selector provided to AnchorJS was invalid.")}else A="h1, h2, h3, h4, h5, h6";if(e=document.querySelectorAll(A),0===e.length)return!1;for(this._addBaselineStyles(),t=document.querySelectorAll("[id]"),o=[].map.call(t,function(A){return A.id}),i=0;i<e.length;i++){if(e[i].hasAttribute("id"))n=e[i].getAttribute("id");else{s=e[i].textContent,a=s.replace(/[^\w\s-]/gi,"").replace(/\s+/g,"-").replace(/-{2,}/g,"-").substring(0,64).replace(/^-+|-+$/gm,"").toLowerCase(),h=a,r=0;do void 0!==l&&(h=a+"-"+r),l=o.indexOf(h),r+=1;while(-1!==l);l=void 0,o.push(h),e[i].setAttribute("id",h),n=h}c=n.replace(/-/g," "),g=document.createElement("a"),g.className="anchorjs-link "+this.options.class,g.href="#"+n,g.setAttribute("aria-label","Anchor link for: "+c),g.setAttribute("data-anchorjs-icon",this.options.icon),"always"===this.options.visible&&(g.style.opacity="1"),""===this.options.icon&&(g.style.fontFamily="anchorjs-icons",g.style.fontStyle="normal",g.style.fontVariant="normal",g.style.fontWeight="normal",g.style.lineHeight=1),"left"===this.options.placement?(g.style.position="absolute",g.style.marginLeft="-1em",g.style.paddingRight="0.5em",e[i].insertBefore(g,e[i].firstChild)):(g.style.paddingLeft="0.375em",e[i].appendChild(g))}return this},this.remove=function(A){for(var e,t=document.querySelectorAll(A),o=0;o<t.length;o++)e=t[o].querySelector(".anchorjs-link"),e&&t[o].removeChild(e);return this},this._addBaselineStyles=function(){if(null===document.head.querySelector("style.anchorjs")){var A,e=document.createElement("style"),t=" .anchorjs-link { opacity: 0; text-decoration: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }",o=" *:hover > .anchorjs-link, .anchorjs-link:focus { opacity: 1; }",n=' @font-face { font-family: "anchorjs-icons"; font-style: normal; font-weight: normal; src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6cv//f//AAAAAAAg6cv//f//AAH/4xY5AAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACADEARAJTAsAAKwBUAAABIiYnJjQ/AT4BMzIWFxYUDwEGIicmND8BNjQnLgEjIgYPAQYUFxYUBw4BIwciJicmND8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFA8BDgEjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAEAAAABAACiToc1Xw889QALBAAAAAAA0XnFFgAAAADRecUWAAAAAAJTAsAAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAAlMAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAACAAAAAoAAMQAAAAAACgAUAB4AmgABAAAABQBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4YW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype"); }',i=" [data-anchorjs-icon]::after { content: attr(data-anchorjs-icon); }";e.className="anchorjs",e.appendChild(document.createTextNode("")),A=document.head.querySelector('[rel="stylesheet"], style'),void 0===A?document.head.appendChild(e):document.head.insertBefore(e,A),e.sheet.insertRule(t,e.sheet.cssRules.length),e.sheet.insertRule(o,e.sheet.cssRules.length),e.sheet.insertRule(i,e.sheet.cssRules.length),e.sheet.insertRule(n,e.sheet.cssRules.length)}}}var anchors=new AnchorJS;

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2411.2 2794"><style>.st0{fill:#fff}.st1,.st2{fill-rule:evenodd;clip-rule:evenodd}.st2{fill:#fff}</style><g id="Layer_x5F_1_x5F_1"><path d="M1204.6 359.2L271.8 30v2030.1l932.8-301.8z"/><path d="M1182.2 358.1L2150.6 29v2030l-968.4-301.7z" class="st0"/><path d="M30 2415.4l1152.2-384V357.9L30 742z" class="st0"/><path d="M1707.2 2440.7l163.3 268.7 86.1-249.6zM421.7 934.8c-6.1-6 8 49.1 27.6 68.9 34.8 35.1 61.9 39.6 76.4 40.2 32 1.3 71.5-8 94.9-17.8 22.7-9.7 62.4-30 77.5-59.6 3.2-6.3 11.9-17 6.4-43.2-4.2-20.2-17-27.3-32.7-26.2-15.7 1.1-63.2 13.7-86.1 20.8-23 7-70.3 21.4-90.9 25.8-20.5 4.5-65.8-2-73.1-8.9zm581.4 658.9c-9.1-3.3-196.9-81.1-223.6-93.9-21.8-10.5-75.2-33.1-100.4-43.3 70.8-109.2 115.5-191.6 121.5-204.1 11-23 86-169.6 87.7-178.7 1.7-9.1 3.8-42.9 2.2-51-1.7-8.2-29.1 7.6-66.4 20.2-37.4 12.6-108.4 58.8-135.8 64.6-27.5 5.7-115.5 39.1-160.5 54-45 14.9-130.2 40.9-165.2 50.4-35.1 9.5-65.7 10.2-85.3 16.2 0 0 2.6 27.5 7.8 35.7 5.2 8.2 23.7 28.4 45.3 34.1 21.6 5.7 57.3 3.4 73.6-.3 16.3-3.8 44.4-17.5 48.2-23.6 3.8-6.1-2-24.9 4.5-30.6 6.5-5.6 92.2-25.7 124.6-35.4 32.4-10 156.3-52.6 173.1-50.5-5.3 17.7-105 215.1-137.1 274-32.1 58.9-218.6 318-258.3 363.6-30.1 34.7-103.2 123.5-128.5 143.6 6.4 1.8 51.6-2.1 59.9-7.2 51.3-31.6 136.9-138.1 164.4-170.5 81.9-96 153.8-196.8 210.8-283.4h.1c11.1 4.6 100.9 77.8 124.4 94 23.4 16.2 115.9 67.8 136 76.4 20 8.7 97.1 44.2 100.3 32.2 3-12.2-14.2-83.1-23.3-86.5z"/><path d="M569 2572c18 11 35 20 54 29 38 19 81 39 122 54 56 21 112 38 168 51 31 7 65 13 98 18 3 0 92 11 110 11h90c35-3 68-5 103-10 28-4 59-9 89-16 22-5 45-10 67-17 21-6 45-14 68-22 15-5 31-12 47-18 13-6 29-13 44-19 18-8 39-19 59-29 16-8 34-18 51-28 13-7 43-30 59-30 18 0 30 16 30 30 0 29-39 38-57 51-19 13-42 23-62 34-40 21-81 39-120 54-51 19-107 37-157 49-19 4-38 9-57 12-10 2-114 18-143 18h-132c-35-3-72-7-107-12-31-5-64-11-95-18-24-5-50-12-73-19-40-11-79-25-117-40-69-26-141-60-209-105-12-8-13-16-13-25 0-15 11-29 29-29 16 0 48 23 54 26zm582-563L61 2372V764l1090-363v1608zm61-1655v1680c-1 5-3 10-7 15-2 3-6 7-9 8-25 10-1151 388-1166 388-12 0-23-8-29-21 0-1-1-2-1-4V739c2-5 3-12 7-16 8-11 22-13 31-16 17-6 1126-378 1142-378 10 0 32 7 32 25z" class="st1"/><path d="M2120 2017l-907-282V380l907-308v1945zm61-1985v2023c-1 23-17 33-32 33-13 0-107-32-123-37-126-39-253-78-378-117-28-9-57-18-84-27-24-7-50-15-74-23-107-33-216-66-323-102-4-1-14-15-14-18V351c2-5 4-11 9-15 8-9 351-123 486-168 36-13 487-168 501-168 18 0 32 13 32 32z" class="st1"/><path d="M2411.2 2440.7l-1211.7-386.2 5.1-1681.3 1206.6 384z"/><path d="M1800.3 1124.6L1681.4 1412l218.6 66.3-99.7-353.7zM1729 853.2l156.1 47.3 284.4 1025-160.3-48.7-57.6-210.4-331.4-100.4-71.3 171.4-160.4-48.7L1729 853.2z" class="st2"/></g></svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -1 +0,0 @@
.highlight .hll{background-color:#ffc}.highlight .c{color:#09f;font-style:italic}.highlight .err{color:#a00;background-color:#faa}.highlight .k{color:#069;font-weight:700}.highlight .o{color:#555}.highlight .cm{color:#09f;font-style:italic}.highlight .cp{color:#099}.highlight .c1,.highlight .cs{color:#09f;font-style:italic}.highlight .cs{font-weight:700}.highlight .gd{background-color:#fcc;border:1px solid #c00}.highlight .ge{font-style:italic}.highlight .gr{color:red}.highlight .gh{color:#030;font-weight:700}.highlight .gi{background-color:#cfc;border:1px solid #0c0}.highlight .go{color:#aaa}.highlight .gp{color:#009}.highlight .gp,.highlight .gs,.highlight .gu{font-weight:700}.highlight .gu{color:#030}.highlight .gt{color:#9c6}.highlight .kc,.highlight .kd,.highlight .kn{color:#069;font-weight:700}.highlight .kp{color:#069}.highlight .kr,.highlight .kt{color:#069;font-weight:700}.highlight .kt{color:#078}.highlight .m{color:#f60}.highlight .s{color:#c30}.highlight .na{color:#309}.highlight .nb{color:#366}.highlight .nc{color:#0a8;font-weight:700}.highlight .no{color:#360}.highlight .nd{color:#99f}.highlight .ne,.highlight .ni{color:#999;font-weight:700}.highlight .ne{color:#c00}.highlight .nf{color:#c0f}.highlight .nl{color:#99f}.highlight .nn,.highlight .nt{color:#0cf;font-weight:700}.highlight .nt{color:#309}.highlight .nv{color:#033}.highlight .ow{color:#000;font-weight:700}.highlight .w{color:#bbb}.highlight .mf,.highlight .mh,.highlight .mi,.highlight .mo{color:#f60}.highlight .sb,.highlight .sc{color:#c30}.highlight .sd{color:#c30;font-style:italic}.highlight .s2{color:#c30}.highlight .se{color:#c30;font-weight:700}.highlight .sh{color:#c30}.highlight .si{color:#a00}.highlight .sx{color:#c30}.highlight .sr{color:#3aa}.highlight .s1{color:#c30}.highlight .ss{color:#fc3}.highlight .bp{color:#366}.highlight .vc,.highlight .vg,.highlight .vi{color:#033}.highlight .il{color:#f60}

View file

@ -1,61 +0,0 @@
<!doctype html>
<html lang="en-au">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title property="og:title">{% if page.lang_title %}{{ page.lang_title }} · {% endif %}{{ site.name }}</title>
<link href="http://fonts.googleapis.com/css?family=PT+Sans|Roboto+Slab|Droid+Sans+Mono" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{{ site.url }}/static/style.css">
<link rel="icon" type="image/png" href="{{ site.url }}/static/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="{{ site.url }}/static/favicon-16x16.png" sizes="16x16" />
<meta content="website" property="og:type">
<meta content="{{ site.url }}" property="og:url">
<meta content="{{ site.time | date_to_xmlschema }}" property="og:updated_time">
<meta content="https://www.facebook.com/holywell" property="article:author">
<meta content="https://www.facebook.com/holywell" property="article:publisher">
<meta content="{{ site.time | date_to_xmlschema }}" property="article:modified_time">
<meta content="" property="article:section">
<meta content="{% if page.lang_title %}{{ page.lang_title }} · {% endif %}{{ site.description }}" itemprop="description" name="description" property="og:description">
<meta content="sql, style guide, code style guide, simon holywell, holywell" itemprop="keywords" name="keywords" property="article:tag">
<meta content="summary" name="twitter:card">
<meta content="{% if page.lang_title %}{{ page.lang_title }} · {% endif %}{{ site.name }}" name="twitter:title">
<meta content="{% if page.lang_title %}{{ page.lang_title }} · {% endif %}{{ site.description }}" name="twitter:description">
<meta content="@treffynnon" name="twitter:site">
<meta content="@treffynnon" name="twitter:creator">
<meta content="{{ site.domain }}" name="twitter:domain">
<link href="http://plus.google.com/+SimonHolywell" rel="author">
<link rel="canonical" href="{{ site.url }}{{ page.url | replace:'index.html',''}}">
<link rel="alternate" hreflang="x-default" href="{{ site.url }}/">
{% include layout_partials/languages.html rel_alternate=true %}
</head>
<body itemscope itemtype="http://schema.org/TechArticle">
<meta itemprop="wordCount" content="{{ content | number_of_words }}">
<meta itemprop="about" content="{{ site.description }}">
<meta itemprop="audience" content="SQL programmers">
<meta itemprop="license" content="http://creativecommons.org/licenses/by-sa/4.0/">
<meta itemprop="version" content="1.0.1">
<meta itemprop="proficiencyLevel" content="Beginner">
<meta itemprop="dependencies" content="SQL knowledge">
<meta itemprop="copyrightHolder" content="Simon Holywell">
{% include layout_partials/head.html %}
<main class="article-body wrap" id="content" itemprop="articleBody" lang="{{ page.lang }}">
{{ content }}
</main>
{% include layout_partials/foot.html %}
<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>
<script src="{{ site.url }}/static/scripts.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.ga_ua_code }}', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>

View file

@ -1 +0,0 @@
{{ content }}

View file

@ -1,13 +0,0 @@
---
layout: default
lang: de
lang_title: SQL-Styleguide
contributors:
- user: AStasyK
type: translator
---
* TOC
{:toc}
{% include sqlstyle.guide.de.md %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

View file

@ -1,9 +0,0 @@
---
layout: default
lang: en
---
* TOC
{:toc}
{% include sqlstyle.guide.md %}

View file

@ -1,14 +0,0 @@
---
layout: default
redirect_from: "/jp"
lang: ja
lang_title: SQLスタイルガイド
contributors:
- user: nkurigit
type: translator
---
* TOC
{:toc}
{% include sqlstyle.guide.ja.md %}

View file

@ -1,13 +0,0 @@
---
layout: default
lang: pt-BR
lang_title: Guia de Estilo SQL
contributors:
- user: pmarcus93
type: translator
---
* TOC
{:toc}
{% include sqlstyle.guide.pt-BR.md %}

View file

@ -1,13 +0,0 @@
---
layout: default
lang: ru
lang_title: Руководство по стилю SQL
contributors:
- user: denpatin
type: translator
---
* TOC
{:toc}
{% include sqlstyle.guide.ru.md %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

View file

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 2411.2 2794" style="enable-background:new 0 0 2411.2 2794;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill-rule:evenodd;clip-rule:evenodd;}
.st2{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
</style>
<g id="Layer_2">
</g>
<g id="Layer_x5F_1_x5F_1">
<g>
<polygon points="1204.6,359.2 271.8,30 271.8,2060.1 1204.6,1758.3 "/>
<polygon class="st0" points="1182.2,358.1 2150.6,29 2150.6,2059 1182.2,1757.3 "/>
<polygon class="st0" points="30,2415.4 1182.2,2031.4 1182.2,357.9 30,742 "/>
<polygon points="1707.2,2440.7 1870.5,2709.4 1956.6,2459.8 "/>
<g>
<path d="M421.7,934.8c-6.1-6,8,49.1,27.6,68.9c34.8,35.1,61.9,39.6,76.4,40.2c32,1.3,71.5-8,94.9-17.8
c22.7-9.7,62.4-30,77.5-59.6c3.2-6.3,11.9-17,6.4-43.2c-4.2-20.2-17-27.3-32.7-26.2c-15.7,1.1-63.2,13.7-86.1,20.8
c-23,7-70.3,21.4-90.9,25.8C474.3,948.2,429,941.7,421.7,934.8z"/>
<path d="M1003.1,1593.7c-9.1-3.3-196.9-81.1-223.6-93.9c-21.8-10.5-75.2-33.1-100.4-43.3c70.8-109.2,115.5-191.6,121.5-204.1
c11-23,86-169.6,87.7-178.7c1.7-9.1,3.8-42.9,2.2-51c-1.7-8.2-29.1,7.6-66.4,20.2c-37.4,12.6-108.4,58.8-135.8,64.6
c-27.5,5.7-115.5,39.1-160.5,54c-45,14.9-130.2,40.9-165.2,50.4c-35.1,9.5-65.7,10.2-85.3,16.2c0,0,2.6,27.5,7.8,35.7
c5.2,8.2,23.7,28.4,45.3,34.1c21.6,5.7,57.3,3.4,73.6-0.3c16.3-3.8,44.4-17.5,48.2-23.6c3.8-6.1-2-24.9,4.5-30.6
c6.5-5.6,92.2-25.7,124.6-35.4c32.4-10,156.3-52.6,173.1-50.5c-5.3,17.7-105,215.1-137.1,274c-32.1,58.9-218.6,318-258.3,363.6
c-30.1,34.7-103.2,123.5-128.5,143.6c6.4,1.8,51.6-2.1,59.9-7.2c51.3-31.6,136.9-138.1,164.4-170.5
c81.9-96,153.8-196.8,210.8-283.4h0.1c11.1,4.6,100.9,77.8,124.4,94c23.4,16.2,115.9,67.8,136,76.4c20,8.7,97.1,44.2,100.3,32.2
C1029.4,1668,1012.2,1597.1,1003.1,1593.7z"/>
</g>
<path class="st1" d="M569,2572c18,11,35,20,54,29c38,19,81,39,122,54c56,21,112,38,168,51c31,7,65,13,98,18c3,0,92,11,110,11h90
c35-3,68-5,103-10c28-4,59-9,89-16c22-5,45-10,67-17c21-6,45-14,68-22c15-5,31-12,47-18c13-6,29-13,44-19c18-8,39-19,59-29
c16-8,34-18,51-28c13-7,43-30,59-30c18,0,30,16,30,30c0,29-39,38-57,51c-19,13-42,23-62,34c-40,21-81,39-120,54
c-51,19-107,37-157,49c-19,4-38,9-57,12c-10,2-114,18-143,18h-132c-35-3-72-7-107-12c-31-5-64-11-95-18c-24-5-50-12-73-19
c-40-11-79-25-117-40c-69-26-141-60-209-105c-12-8-13-16-13-25c0-15,11-29,29-29C531,2546,563,2569,569,2572z"/>
<path class="st1" d="M1151,2009L61,2372V764l1090-363V2009z M1212,354v1680c-1,5-3,10-7,15c-2,3-6,7-9,8c-25,10-1151,388-1166,388
c-12,0-23-8-29-21c0-1-1-2-1-4V739c2-5,3-12,7-16c8-11,22-13,31-16c17-6,1126-378,1142-378C1190,329,1212,336,1212,354z"/>
<path class="st1" d="M2120,2017l-907-282V380l907-308V2017z M2181,32v2023c-1,23-17,33-32,33c-13,0-107-32-123-37
c-126-39-253-78-378-117c-28-9-57-18-84-27c-24-7-50-15-74-23c-107-33-216-66-323-102c-4-1-14-15-14-18V351c2-5,4-11,9-15
c8-9,351-123,486-168c36-13,487-168,501-168C2167,0,2181,13,2181,32z"/>
<polygon points="2411.2,2440.7 1199.5,2054.5 1204.6,373.2 2411.2,757.2 "/>
<g>
<path class="st2" d="M1800.3,1124.6L1681.4,1412l218.6,66.3L1800.3,1124.6z M1729,853.2l156.1,47.3l284.4,1025l-160.3-48.7
l-57.6-210.4L1620.2,1566l-71.3,171.4l-160.4-48.7L1729,853.2z"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -1,84 +0,0 @@
---
layout: nil
---
{% include static/anchor.min.js %}
anchors.add('h2,h3,h4,h5,h6');
document.addEventListener('DOMContentLoaded', () => {
/*
* translation jump menu
*/
document.getElementById('language-drop').addEventListener('change', e => {
var selected = e.target.selectedOptions[0].value + '/';
if (selected === 'en/') selected = '';
window.location.href = `{{ site.url }}/${selected.toLowerCase()}`;
});
/*
* ScrollTo code
*/
document.querySelectorAll('a[href^="#"]')
.forEach(x => x.addEventListener('click', e => {
var targetHash = e.target.hash.replace(/:/g,'\\$&'),
targetDecoded = decodeURI(targetHash),
targetId = targetDecoded.replace('#', ''),
target = document.getElementById(targetId || 'translation-bar');
if (target) {
e.preventDefault();
target.scrollIntoView({behavior: 'smooth', block: 'start'});
}
}));
});
// http://exisweb.net/link-tracking-universal-analytics
(function trackOutbounds() {
var hitCallbackHandler = function(url,win) {
if (win) {
window.open(url, win);
} else {
window.location.href = url;
}
};
var addEvent = function(el, eventName, handler) {
if (el.addEventListener) {
el.addEventListener(eventName, handler);
} else {
el.attachEvent('on' + eventName, function(){
handler.call(el);
});
}
};
if (document.getElementsByTagName) {
var el = document.getElementsByTagName('a');
var getDomain = document.domain.split('.').reverse()[1] + '.' + document.domain.split('.').reverse()[0];
// Look thru each a element
for (var i=0; i < el.length;i++) {
// Extract it's href attribute
var href = (typeof(el[i].getAttribute('href')) == 'string' ) ? el[i].getAttribute('href') : '';
// Query the href for the top level domain (xxxxx.com)
var myDomain = href.match(getDomain);
// If link is outbound and is not to this domain
if ((href.match(/^(https?:|\/\/)/i) && !myDomain) || href.match(/^mailto\:/i)) {
// Add an event to click
addEvent(el[i],'click', function(e) {
var url = this.getAttribute('href'), win = (typeof(this.getAttribute('target')) == 'string') ? this.getAttribute('target') : '';
// Log even to Analytics, once done, go to the link
ga('send', 'event', 'outbound', 'click', url,
{'hitCallback': hitCallbackHandler(url,win)},
{'nonInteraction': 1}
);
e.preventDefault();
});
}
}
}
})();

View file

@ -1,239 +0,0 @@
---
layout: nil
---
{% assign primary_colour = '#DE1B1B' %}
/*
Begin styles from codeguide.co by @mdo
*/
html {
font-size: 16px;
}
@media (min-width: 48em) {
html {
font-size: 20px;
}
}
body {
margin: 0;
font: 1rem/1.5 "PT Sans", sans-serif;
color: #333;
}
/*
End styles from codeguide.co by @mdo
*/
/*
* Page navigation
*/
#page-nav {
bottom: 0.5em;
right: 0.5em;
position: fixed;
text-align: center;
font-weight: bold;
}
/*
* Typography
*/
h1 {
font-family: 'Roboto Slab', serif;
font-weight: 400;
}
h2 {
font-family: 'Roboto Slab', serif;
font-weight: 400;
border-bottom: 0.25em solid #e2e2e2;
padding-bottom: 0.3em;
}
h3:before {
content: '➤';
width: 1.5em;
display: inline-block;
margin-left: -1.5em;
color: {{ primary_colour }};
font-weight: normal;
}
a {
color: #333;
border-bottom: 1px solid {{ primary_colour }};
text-decoration: none;
-o-transition:.2s;
-ms-transition:.2s;
-moz-transition:.2s;
-webkit-transition:.2s;
transition:.3s;
}
a:hover {
color: {{ primary_colour }};
border-color: #333;
}
#translation-bar {
background: linear-gradient(top, #444, #111);
background: -ms-linear-gradient(top, #444, #111);
background: -webkit-gradient(linear, left top, left bottom, from(#444), to(#111));
background: -moz-linear-gradient(top, #444, #111);
text-align: right;
color: #999;
}
#translation-bar .wrap {
padding: .5% 10%;
}
#translation-bar nav {
font-size: .7em;
}
#translation-bar a {
color: inherit;
}
#translation-bar .language-ico { display: inline }
#translation-bar .language-ico svg {
width: 25px;
margin-bottom: -10px;
fill: {{ primary_colour }};
margin-left: 10px;
}
#translation-bar .language-drop {
height: 25px;
color: #999;
background-color: #222;
}
header.top {
background: {{ primary_colour }};
color: #333;
}
header.top h1 {
color: #fff;
margin-bottom: 0;
}
header.top p.author {
margin-top: 0;
}
header.top p.translator {
font-size: smaller;
}
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;
}
@media (max-width: 28.75em) {
header.top p.twitter {
float: none;
margin-top: 0;
}
}
.wrap {
padding: 2% 10%;
max-width: 48em;
margin: 0 auto;
}
#content h1 {
display: none;
}
ul#markdown-toc {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-gap: 1em;
-moz-column-gap: 1em;
column-gap: 1em;
margin-bottom: 2.8em;
}
.foot hr {
font-family: 'Roboto Slab', serif;
padding: 0;
border: none;
border-top: 0.1em solid #E2E2E2;
color: #E2E2E2;
text-align: center;
}
.foot hr:after {
content: "§";
display: inline-block;
position: relative;
top: -0.925em;
font-size: 1.5em;
padding: 0 0.25em;
background: white;
}
.foot .buttons {
margin-top: 3em;
}
.quick-links {
list-style: none;
margin-left: 0;
text-align: center;
}
.quick-links li {
display: inline;
}
/* Syntax highlighting */
div.highlighter-rouge {
max-height: 450px;
overflow-y: auto;
border: 2px solid #eee;
margin: 1em 0;
background-color: #fefefe
}
div.highlighter-rouge div.highlight {
padding: .5em .825em;
}
div.highlighter-rouge pre.highlight {
margin: 0;
display: block;
line-height: 1.1;
}
code {
font-size: .825em;
font-family: 'Droid Sans Mono', monospace;
color: #555;
}
{% include static/manni.css %}
.anchorjs-link {
color: {{ primary_colour }};
border: none;
}

View file

@ -1,15 +0,0 @@
---
layout: default
lang: zh-TW
lang_title: SQL樣式指南
contributors:
- user: Leon0824
type: translator
- user: nimula
type: correction
---
* TOC
{:toc}
{% include sqlstyle.guide.zh-TW.md %}

View file

@ -1,15 +0,0 @@
---
layout: default
lang: zh
lang_title: SQL样式指南
contributors:
- user: wontoncoder
type: translator
- user: penghou620
type: correction
---
* TOC
{:toc}
{% include sqlstyle.guide.zh.md %}