The first company to successfully put a product on the market using SQL was Oracle Corporation. It was based on the ideas put forth by E. Codd in his paper “A Relational Model of Data for Large Shared Data Banks”. According to an article written by Ron Plew and Ryan Stephens called “Welcome to the World of SQL” the American National Standards Institute (ANSI) approved SQL for relational databases in the 1980’s. Soon after the international community through the International Standards Organization (ISO) did the same.

The SQL Database

A SQL database is a relational database where information is organized into tables. The information on each table is closely related the information on one or more tables in the database. Creating a new database can be accomplished by the following command:

CREATE DATABASE name_of_database;.

Many database applications also allow you to create a new database through an interface.

Creating and Manipulating a Table

The structure of any relational database consists of tables with information arranged in a series of columns and rows. The commands found in the data definition section of SQL are used to create and change tables. They include, but are not limited to: CREATE, ALTER and DROP.

Introduction to SQL: Getting Started: A Query Language for Relational Database Management Systems
Introduction to SQL: Getting Started: A Query Language for Relational Database Management Systems

CREATE TABLE creates a new table in a database where the user can assign specific properties to each column. An example is:

CREATE TABLE Employees

(

Employeeid int,

Lastname varchar(50),

Firstname varchar(50),

Startdate date

)

The resulting table is named ‘Employees’ and has four columns each with a specific data type. Data types designate the kind of data, such as characters, numbers or dates that are assigned to a column. The Employeeid column will have data that consists of int, or integer, values.

ALTER and DROP commands are used to manipulate tables that already exist. ALTER can be used to add a column or change the data types in an existing table. In SQL the syntax for adding a column with ALTER is:

ALTER TABLE name_of_table

ADD name_of_column datatype;

Changing an existing column follows this syntax:

ALTER TABLE name_of_table

ALTER COLUMN name_of_column datatype;

DROP TABLE can be used to delete a table from a database while adding DROP COLUMN to an ALTER statement will remove a column from a table as follows:

ALTER TABLE name_of_table DROP COLUMN name_of_column;