SQL Commands

To implement and retrieve data from a database we use both Data Definition Language (DDL) and Data Manipulation Language (DML).

DDL is the collection of SQL commands that are concerned with creating and configuring a database and the tables within it.

DML is concerned with the inserting, deleting and modification of data in a database.

Data Definition Languages (DDL)

Create a Database

To create a database:

CREATE DATABASE database_name;

To create a database table, you need to use the information available in the data dictionary. This details the constraints and data types to be applied to each column when it is implemented.

The columns in a table are the attributes from the data dictionary.

Constraints

Constraints for a table will specify whether an attribute:

Primary Key

To specify that a column is the primary key, the PRIMARY KEY constraint is used in the CREATE TABLE statement: