Structural Query Language (SQL)
Structural Query Language (SQL)
1. CREATE DATABASE:
• The CREATE DATABASE statement is used to create a new SQL
database.
• Syntax:
CREATE DATABASE <databasename>;
2. CRAETE TABLE:
The CREATE TABLE statement is used to create a new table in a database.
Syntax:
CREATE TABLE table_name ( column1 datatype, column2 datatype,
column3 datatype);
DDL Command… 7
3. ALTER TABLE
• The ALTER TABLE statement is used to add, delete, or modify columns in an
existing table.
• The ALTER TABLE statement is also used to add and drop various constraints on
an existing table.
Syntax:
ALTER TABLE table_name
ADD column_name datatype;
4. DROP TABLE
• The DROP DATABASE statement is used to drop(delete) an existing
SQL database.
• DROP DATABASE databasename;
Data Manipulation Language (DML) 9
Example
CREATE TABLE student(ID int NOT NULL PRIMARY KEY, NAME
VARCHAR(10),SEX VARCHAR(4) );
ID NAME SEX
INSERT INTO 13