Overview of SQL : SQL is a scripting language for the database handling. SQL is called as Structured Query Language. SQL is used to handle relational database, we can create, update, delete, and fetch records from the database. SQL is a powerful and very widely used database language.
You can think SQL as a standard language to communicate with the relational database systems. There are different relational database management systems available in the market like MS Access, MS SQL Server, PostgresSql, Oracle and Sybase etc. uses the Sql as standard language.
Type of SQL Statements :
DDL (Data Definition Language)
DML (Data Manipulation Language)
DCL (Data Control Language)
TCL (Transaction Control Language).
1) DDL : DDL statements are used to deal with schema and structure of database. Following are the mostly used statements :
CREATE : statement is used to create
a new database schema.
ALTER : statement is used to alter
the database schema.
DROP : statement is used to drop or
delete the database schema.
TRUNCATE : statement is used to
truncate(empty) the database schema
RENAME : statement is used to rename
the database schema or table.
2) DML : DML statements are used to manipulate the data of the database object. Following are mostly used statements :
SELECT : statement fetches the data
from the database.
INSERT : statement insert the data
to the database.
UPDATE : statement update the data
in the database.
DELETE : statement deletes the data
from the databaes.
CALL : statement call the PL/SQL
LOCK TABLE : to handle the data
3) DCL : The following commands are come under Data Control Language
GRANT : statement used to grant
access privillages to the db users.
REVOKE : statement used to remove
the given db access privillages to
4) TCL : TCL statements forces the database to fulfil the ACID property. Following commands comes under the TCL.
COMMIT : to commit or save data into
ROLLBACK : using this statement we
can rollback the database to the
point where last commited.
SAVEPOINT : can set a point from
where we can rollback later if