SQL
SQL
15/22 IInd Floor Ashok Nagar, New Delhi-110018. Ph.: 25499279, 55711031(O), 9810865706(M)
Class: XII C++ STRUCTURED QUERY LANGUAGE
* Structured Query Language (SQL) is a language that enables to create and operate on relational
databases, which are sets of related information stored in tables.
* Data Definition Language (DDL): The SQL DDL provides commands for defining relation schema,
deleting relations, creating indexes, and modifying relation schemes.
* Data Manipulation Language (DML): The SQL DML includes a query Language bases on both
relational algebra and tuple relational calculus. It includes commando to insert, delete and modify
tuples in database.
DATA DEFINITION LANGUAGE
A database scheme is specified by a set of definitions which are expressed by a special language
called DDL. The result of compilation of DDL statement is set of tables stored in data dictionary (or
directory)
* DATA DICTIONARY is file that contains “meta data” i.e. “data about data”.
CHECK CONSTRAINT
It limits values that can be inserted into a column of a table
CREATE TABLE employee
(
ecode integer NOT NULL PRIMARY KEY,
ename char(20) NOT NULL,
sex char (1) NOT NULL,
grade char (2) DEFAULT = ‘E’
gross decimal CHECK (gross > 2000);
* This statement ensures that value inserted for gross must be greater than 2000
* It is specified after all, the column, when it involves more than one column
CREATE TABLE items
(
icode char(5),
descp char (20),
ROL integer,
QOH integer,
CHECK (ROL < QOH);
Compares two columns ROL and QOH, hence two columns must defined before check constraint.