Chapter 4

Creating a Database with SQL

IN THIS CHAPTER

Bullet Building tables

Bullet Setting constraints

Bullet Establishing relationships between tables

Bullet Altering table structure

Bullet Deleting tables

As I stated way back in Book 1, Chapter 5, SQL is functionally divided into three components: the Data Definition Language (DDL), the Data Manipulation Language (DML), and the Data Control Language (DCL). The DDL consists of three statements: CREATE, ALTER, and DROP. You can use these statements to create database objects (such as tables), change the structure of an existing object, or delete an object. After you have designed a database, the first step in bringing it into reality is to build a table with the help of the DDL. After you have built the tables, the next step is to fill them with data. That’s the job of the DML. As for the DCL, you call on it to help you preserve data integrity. In this chapter, I discuss the functions of the DDL. The aspects of the DML that were not covered in Book 1 — namely queries ...

Get SQL All-In-One For Dummies, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.