Fundamenatal Database
Fundamenatal Database
DDL or Data Definition Language actually consists of the SQL commands that can be used to
define the database schema. It simply deals with descriptions of the database schema and is
used to create and modify the structure of database objects in the database.DDL is a set of SQL
commands used to create, modify, and delete database structures but not data. These
commands are normally not used by a general user, who should be accessing the database via
an application.
List of DDL commands:
CREATE: This command is used to create the database or its objects (like table, index,
function, views, store procedure, and triggers).
SQL COMMAND
DEFINING DATABSE
CREATE DATABASE SUMMER_STUDENT;
DEFINING TABLE
CREATE TABLE IT
(
ID VARCHAR (25) PRIMARY KEY NOT NULL,
FIRST_NAME VARCHAR (30) NOT NULL,
LAST_NAME VARCHAR (30) NOT NULL,
SEX CHAR (6) NOT NULL,
SECTION INT NOT NULL
);
DROP: This command is used to delete objects from the database.
SQL COMMAND
REMOVING DATABASE
DROP DATABASE DATABSE NAME;
Ex. DROP DATABSE SUMMER_STUDENT;
REMOVING TABLE
DROP TABLE TABLE NAME;
Ex. DROP TABLE IT;
TRUNCATE: This is used to remove all records from a table, including all spaces
allocated for the records are removed.
SQL COMMAND
TRUNCATE TABLE TABLE_NAME;
EX. TRUNCATE TABLE IT;
COMMENT: This is used to add comments to the data dictionary.
RENAME: This is used to rename an object existing in the database.
DML (DATA MANIPULATION LANGUAGE)
The SQL commands that deal with the manipulation of data present in the database belong to
DML or Data Manipulation Language and this includes most of the SQL statements. It is the
component of the SQL statement that controls access to data and to the database. Basically,
DCL statements are grouped with DML statements.
create table it