Contents / Previous / Next


SQL Basics

The basic structure in SQL is the statement.
Semicolons separate multiple SQL statements.

Statements are composted of tokens.
A token can be a key word, an identifier, a quoted identifier,
a literal (or constant), or a special character symbol.
Tokens are normally separated by whitespace (space, tab, newline).
Whitespace may be used freely in SQL commands.

SQL is case insensitive about key words and identifiers, except when identifiers are double-quoted to preserve the case.

There are 3 basic categories of SQL Statements:

  1. Data definition language (DDL) --
    SQL-Schema Statements -- maintain schema (catalog)

  2. Interactive (or Embedded) data manipulation language (DML) --
    SQL-Data Statements -- query and modify tables and columns

  3. SQL-Transaction Statements -- control transactions


White Space and Comments

White space (i.e., spaces, tabs and newlines) may be used freely in SQL queries.

Single-line comments are denoted by --
Multiple-line comments, and comments within a line,
are denoted by /* ... */