Giter VIP home page Giter VIP logo

sql-notes's Introduction

The repository contains notes about parts of SQL that differ the most in PostgreSQL, MySQL, Oracle, SQL Server, and SQLite. Currently there are notes about:

  • organization of DBMSs (databases, schemas, users, connecting to DBMS, the SET ROLE statement, referencing database objects, synonyms, tablespaces),
  • string, mathematical, and time built-in functions,
  • access control,
  • triggers (I didn't describe triggers in SQL Server, because their syntax differs significantly from other DBMSs),
  • sequences,
  • paging the result of a SELECT query,
  • query optimization (indexes and query execution plan).

The notes are quite complete. At the same time, they are concise, because I wrote information common for all DBMS, and marked the differences.

DBMS organization

Sources of information:

Built-in functions

Sources of information:

  • syntax and description of the SQL Standard,
  • draft of the SQL:2011 Standard - drafts of all parts are linked as "SQL:20nn Working Draft Documents" at http://www.wiscorp.com/SQLStandards.html,
  • the documentations of PostgreSQL, MySQL, Oracle, SQL Server, and SQLite - I checked them in November 2020

DDL - Triggers

Sources of information:

  • syntax of trigger definition in the SQL Standard and its description,
  • PostgreSQL, MySQL, and SQLite documentation about triggers. I already knew how triggers work in Oracle, so I haven't read Oracle documentation.

The triggers-additional-info.md file contains additional notes about DML triggers in PostgreSQL and about system triggers.

DDL - Sequences

Sources of information:

  • syntax of sequence definition and its usage in SQL Standard,
  • PostgreSQL, MySQL, Oracle, SQL Server, and SQLite documentation about sequences,
  • additionally, I read about the alternative of a sequence - an "identity" field generated automatically from an implicit sequence - both in SQL Standard and in PostgreSQL, MySQL, Oracle, SQL Server and SQLite documentation.

SQL - Paging

Sources of information:

  • syntax of OFFSET and FETCH FIRST clauses in SQL Standard,
  • PostgreSQL, MySQL, Oracle, SQL Server, and SQLite documentation.

Access control - DCL

Sources of information:

Query optimization

Sources of information:

  • Wikipedia articles about indexes and query plans,
  • PostgreSQL, MySQL, SQL Server, and SQLite documentation about indexes. I only read the most essential information in the SQL Server documentation. I already knew how indexes work in Oracle, so I haven't read Oracle documentation.
  • use-the-index-luke.com/sql/explain-plan and subpages.

Symbols and marking used in the notes

The following marking are used in the notes:

  • green underscore - syntax or behavior defined by SQL Standard
  • orange underscore - differences in RDBMS
  • blue underscore - when was a syntax introduced to a RDBMS?
  • purple underscore - this information is related to transactions
  • P M O S L - each letter means respectively: PostgreSQL, MySQL, Oracle, SQL Server, SQLite; they are used on the left margin or in parentheses: (PMOSL: ...)
  • [..] - an option
  • {..|..} - a choice (sometimes also: ..|.. if it isn't ambiguous, e.g. [..|..] - an optional choice)
  • - logical "or"
  • => - logical implication
  • - equality (used for example for aliases)

All SQL keywords are written in UPPERCASE.

Generating PDF files

The PDF files were generated from the DOCX files, which are available at the src directory, using Microsoft Word 2016.

sql-notes's People

Contributors

iwis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.