Structured Query Language (SQL)
Home ] Up ] Relational Databases ] [ Structured Query Language (SQL) ] What is JDBC? ] Connecting to Databases ] SQL Errors and Warnings ] Accessing Databases ] Creating and Populating a Database ] Transactions ] Prepared and Callable Statements ] Using Metadata ]

 

DML Statements
DDL Statements
Transaction Statements

 

The most common language used with relational databases is Structured Query Language (SQL, often pronounced "Sequel"), which was invented by IBM in the 1970s. It became an ANSI (Americal National Standards Institute) standard in 1986 (SQL-86), and this was followed by an updated standard in 1989 (SQL-89). In 1992, ANSI and ISO (International Standards Organization) published an updated standard for SQL, called SQL-92.

SQL is rather an unwieldy language, and it is (especially as specified in more recent standards) an extremely large language. Unfortunately, despite the standardization efforts, and because of the dominance of a small number of database vendors who have proprietary implementations of the SQL language, with their own extensions and quirks, a true, practical, SQL standard is still not a reality.

SQL is a Set-Oriented Language

It is important to realize that SQL is a set-oriented language. This means that most operations performed using SQL statements do not operate on a single row in a table, but instead operate on multiple rows in a table.

Categories of SQL Statements

SQL statements may be categorized into the following groups:

  • Data Manipulation Language (DML) statements:
    • SELECT statements
    • INSERT, DELETE and UPDATE statements
  • Data Definition Language (DDL) statements:
    • CREATE ... statements
    • ALTER... statements
  • GRANT statements
  • Transaction Management statements
    • SET TRANSACTION statements
    • COMMIT statements
    • ROLLBACK statements

Here are detailed discussions of each of these categories:

References

SQL is a very complex language, and I cannot hope to give it more than introductory coverage here. There are quite a few books that do a much more comprehensive job of describing the SQL language, including the following:

  • Understanding the New SQL : A Complete Guide (The Morgan Kaufmann Series in Data Management Systems) by Jim Melton & Alan R. Simon (March 1993) Morgan Kaufmann Publishers; ISBN: 1558602453
  • Understanding the New SQL : A Complete Guide by Jim Melton & Alan Simon 2nd edition (to be published December 2000) Morgan Kaufmann Publishers; ISBN: 1558604561
  • A Guide to the SQL Standard : A User's Guide to the Standard Database Language SQL by Hugh Darwen & C. J. Date, 4th edition (April 1997) Addison-Wesley Pub Co; ISBN: 0201964260

For the classic book on databases, take a look at:

  • An Introduction to Database Systems by C. J. Date 7th edition (October 1999) Addison-Wesley Pub Co; ISBN: 0201385902

(but note that it's not exactly bedtime reading...)

 
The page was last updated February 19, 2008