Structured Query Language

From Wikibooks, open books for an open world
Jump to: navigation, search


Loupe light.svg

Structured Query Language (SQL) is a widely-used programming language for working with relational databases. SQL is generally pronounced as the three letters in the name, e.g. ess-cue-ell, or in some people's usage, as the word sequel.

This Wikibook provides a short description of SQL, its origins, basic concepts and components, and numerous examples. The book follows the specifications of the SQL:2011 standard, which is developed by a common committee of ISO and IEC. Their publications are not freely available. However, a working draft of SQL:2008 can be downloaded from Whitemarsh Information Systems Corporation and used for further assistance.


For a thorough look at special SQL implementations, see MySQL or Oracle Programming/SQL Cheatsheet.
For a comparison of SQL dialects/implementations, see SQL Dialects Reference.
For additional examples see SQL Exercises.


Introduction

  1. About the Book 100% developed  as of 21 May, 2012
  2. Database Management Systems (DBMS) 100% developed  as of 21 May, 2012
  3. Relational DBMS (rDBMS) 100% developed  as of 21 May, 2012
  4. SQL: A Language for Working with rDBMS 100% developed  as of 21 May, 2012
  5. SQL: The Standard ISO IEC 9075 and various Implementations 100% developed  as of 21 May, 2012


The Snippets Corner Take a snippet

SELECT code FROM examples WHERE topic = ...


Two Parallel Tracks: Standard and Classic

Standard Track

Classic Track


Foundation
Create a simple Table
Handle Data
Example Database Structure
Example Database Data

Basic Commands
SELECT Fundamentals









COMMIT and ROLLBACK
INSERT
UPDATE

DELETE

Daily Operations
SELECT

Join Operation
Grouping
IS NULL Predicate
Predefined Functions
Set Operations
Case Expression
Subquery

Views

INSERT
UPDATE
MERGE
DELETE
TRUNCATE


Advanced Topics (Work in Progress)
Managing Tables

CREATE TABLE
Data Types
Foreign Key
Alter Table
Drop Table
Temporary Table

Managing Indexes
Managing Views
Managing Rights (GRANT / REVOKE)
Advanced SELECT features

Like Predicate
IN, SOME/ANY, ALL
EXISTS
Recursions
Windowing functions

NULL Values and the Three Value Logic
Transactions / Isolation Levels




100% developed  as of 13 Dec, 2011 Relational Databases





100% developed  as of 13 Dec, 2011 Data Query Language










100% developed  as of 13 Dec, 2011 Data Manipulation Language








100% developed  as of 13 Dec, 2011 Data Definition Language






100% developed  as of 13 Dec, 2011 Performance


100% developed  as of 13 Dec, 2011 Data Control Language

End of Parallel Tracks


Appendices

  1. Glossary 100% developed  as of 13 Dec, 2011
  2. Return Codes 100% developed  as of 13 Dec, 2011