Wikibooks: Database Design/SQL Structured Query Language

Structured Query Language (SQL) is a database language designed for managing data held in a relational database management system. SQL was initially developed by IBM in the early 1970s (Date 1986). The initial version called SEQUEL (Structured English Query Language) was designed to manipulate and r...

Full description

Bibliographic Details
Format: Book
Language:English
Subjects:
DML
Online Access:https://en.wikibooks.org/wiki/Database_Design/SQL_Structured_Query_Language
Description
Summary:Structured Query Language (SQL) is a database language designed for managing data held in a relational database management system. SQL was initially developed by IBM in the early 1970s (Date 1986). The initial version called SEQUEL (Structured English Query Language) was designed to manipulate and retrieve data stored in IBM’s quasi relational database management system System R. Then in the late 1970s Relational Software Inc. which is now Oracle Corporation introduced the first commercially available implementation of SQL Oracle V2 for VAX computers. Many of the currently available relational DBMSs such as Oracle Database Microsoft SQL Server (shown in Figure 15.1) MySQL IBM DB2 IBM Informix and Microsoft Access use SQL. Figure 15.1. Example of Microsoft SQL Server by A. Watt. In a DBMS the SQL database language is used to Create the database and table structures Perform basic data management chores (add delete and modify) Perform complex queries to transform raw data into useful information In this chapter we will focus on using SQL to create the database and table structures mainly using SQL as a data definition language ( DDL ). In Chapter 16 we will use SQL as a data manipulation language ( DML ) to insert delete select and update data within the database tables. = Create Database = The major SQL DDL statements are CREATE DATABASE and CREATE/DROP/ALTER TABLE. The SQL statement CREATE is used to create the database and table structures. Example CREATE DATABASE SW A new database named SW is created by the SQL statement CREATE  DATABASE SW. Once the database is created the next step is to create the database tables. The general format for the CREATE TABLE command is CREATE TABLE ( ColumnName Datatype Optional Column Constraint ColumnName Datatype Optional Column Constraint Optional table Constraints ) Tablename is the name of the database table such as Employee. Each field in the CREATE TABLE has three parts (see above) ColumnName Data type Optional Column Constraint = ColumnName = The ColumnName must be ...