Part of the
You Can Learn SQL series.
By Ken Brown
Editor, YouCanLearnSeries.com
Updated: August 31, 2004
SQL is Structured Query Language. A language specifically designed to work with
data that resides in relational databases.
SQL is not a procedural language. You wouldn’t use it like you would a language
like Visual Basic or C++. SQL is a language built on using set theory on
records. You ask the database what you want using SQL and the database returns
a result set in its most optimized way based on the question you asked.
SQL does more than work with data. You can create databases, alter databases,
drop different objects in the database. There are SQL tools to add new data to
a database and retrieve information from the database. The reason SQL was
developed was to work with relational databases.
SQL has three command languages to help it manage the database and its objects
and to handle data.
1. DCL – Data Control Language
2. DML – Data Manipulation Language
3. DDL – Data Definition Language
The Data Control Language has tools to protect the database from harm.
The commands of the DCL are COMMIT, ROLLBACK, GRANT and REVOKE. These help
prevent accidental deletion of records from the database.
The Data Manipulation Language contains the statements that retrieve and
maintain the data found in a database table. The commands are SELECT, INSERT,
DELETE and UPDATE.
The Data Definition Language is used for defining database objects. The
commands are CREATE, ALTER and DROP and can be used on a variety of objects in
a database.
There are also reserved words and specific data types that are available.
In review, with SQL the whole idea is to collect a set of records that match
the criteria you specify and then perform some operation on those records. It
is also used to create a database and the objects that are necessary to support
the database.
|