411 REFERENCE · Wikibooks
Structured Query Language
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
__NOTOC__
__NOEDITSECTION__
Structured Query Language (SQL) is a widely-used programming language for working with relational databases. The name of the language is generally pronounced as the three letters of its abbreviation En-us-SQL.ogg no ˈɛs kjuː ˈɛl or, in some people's usage, as En-us-sequel.ogg no ˈsiːkwəl.
This Wikibook provides a short description of SQL, its origins, basic concepts and components, and many examples. The book follows the specifications of the SQL:2011 standard developed by a common committee of ISO and IEC. Their publications are not freely available but can be ordered online. http://www.iso.org/iso/catalogue_detail.htm?csnumber=53682 ISO/IEC 9075-2:2011: Information technology -- Database languages -- SQL -- Part 2: Foundation (SQL/Foundation) Or you may want to refer to a working draft that you can download from Whitemarsh Information Systems Corporation.
Structured Query Language/Print version
SQL
SQL
Introduction
/About the Book/
/Database Management Systems (DBMS)/
/Relational DBMS (rDBMS)/
/SQL: A Language for Working with rDBMS/
/SQL: The Standard ISO IEC 9075 and various Implementations/
/Language Elements/
/Learning by Doing/
The Snippets Corner 40px|Take a snippet
SELECT code FROM examples WHERE topic = ...
Foundation
Create a simple Table
Handle Data
Example Database Structure
Example Database Data
Data Query Language
SELECT Fundamentals
Join Operation
Grouping
IS NULL Predicate
Predefined Functions
Set Operations
Case Expression
Subquery
Views
Data Manipulation Language
INSERT
INSERT, using Subqueries
UPDATE
UPDATE, using Subqueries
DELETE
DELETE, using Subqueries
MERGE
TRUNCATE
COMMIT and ROLLBACK
Data Definition Language
CREATE TABLE
Data Types
Foreign Key
Alter Table
Drop Table
Temporary Table
Indexes
Data Control Language
Managing Rights (GRANT / REVOKE)
Advanced Topics
Additional SELECT features
Pattern Matching (LIKE Predicate and much more)
IN, SOME/ANY, ALL, EXISTS
Advanced Grouping: Rollup / Cube
Window functions (Data Warehouses, OLAP)
With Clause (Common Table Expression CTE)
Recursions
NULLs and the Three Valued Logic
Transactions / Isolation Levels
Some Notes on typical SQL (non-trivial) Tasks
Retrieve Top N Rows per Group
Eliminate Duplicates
Appendices
Warnings and Exceptions (SQLSTATE)
/Glossary/
References
See also
Wikibook MariaDB
Wikibook Microsoft SQL Server
Wikibook MySQL
Wikibook Oracle Database
Wikibook PostgreSQL
Wikibook SQLite
Wikibook SQL Dialects Reference
Wikibook SQL Exercises
Wikipedia: SQL Key Words
SQL
S
100%