Chapter 1. Introduction to SQL
In this introductory chapter, we explore the origin and utility of the SQL language, demonstrate some of the more useful features of the language, and define a simple database design from which most examples in the book are derived.
What Is SQL?
SQL, which stands for Structured Query Language, is a special-purpose language used to define, access, and manipulate data. SQL is nonprocedural, meaning that it describes the necessary components (i.e., tables) and desired results without dictating exactly how results should be computed. Every SQL implementation sits atop a database engine, whose job it is to interpret SQL statements and determine how the various data structures in the database should be accessed in order to accurately and efficiently produce the desired outcome.
The SQL language includes two distinct sets of commands: Data Definition Language (DDL) is the subset of SQL used to define and modify various data structures, while Data Manipulation Language (DML) is the subset of SQL used to access and manipulate data contained within the data structures previously defined via DDL. DDL includes numerous commands for handling such tasks as creating tables, indexes, views, and constraints, while DML is comprised of just four statements:
- INSERT
Adds data to a database.
- UPDATE
Modifies data in a database.
- DELETE
Removes data from a database.
- SELECT
Retrieves data from a database.
Some people feel that DDL is the sole property of database administrators, ...