SQL is a standard language for accessing and manipulating databases.
According to ANSI (American National Standards Institute), it is the standard language for relational database management systems.
SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database.
The standard SQL commands are such as “Select”, “Insert”, “Update”, “Delete”, “Create”, and “Drop”.The data in RDBMS is stored in database objects called tables.
A table is a collections of related data entries and it consists of columns and rows.
SQL can be divided into:
The Data Manipulation Language (DML) and
the Data Definition Language (DDL) ,
Data Control Language (DCL) and
Transactional Control Language (TCL) .
1) The query and update commands form the DML part of SQL.
SELECT – extracts data from a Table.
UPDATE – updates data in a Table.
DELETE – deletes data from a Table.
INSERT INTO – inserts new data into a Table.
2) The DDL part of SQL permits database tables to be created or deleted. The most important DDL statements in SQL are:
CREATE DATABASE – creates a new database.
ALTER DATABASE – modifies a database.
CREATE TABLE – creates a new table.
ALTER TABLE – modifies a table.
DROP TABLE – deletes a table.
CREATE INDEX – creates an index (search key).
3) DCL: DCL stands for Data Control Language. DCL is used to create roles, grant and revoke permissions, establish referential integrity etc.
Examples: GRANT, REVOKE statements
4) TCL: TCL stands for Transactional Control Language. TCL is used to manage transactions within a database.
Examples: COMMIT, ROLLBACK statements