Categories of SQL statements

Categories of SQL statements:-

SQL is a simple and powerful language used to create, access, and manipulate data and structure in the database. SQL statements into various categories, which are:

Data Definition Language
Data Manipulation Language
Transaction Control Statements
Data Control Language


DATA RETRIEVAL:- SELECT

DATA MANIPULATION LANGUAGE (DML):- INSERT, UPDATE, DELETE, MERGE

DATA DEFINITION LANGUAGE (DDL):- CREATE, ALTER, DROP , RENAME, TRUNCATE

TRANSACTION CONTROL:- COMMIT, ROLLBACK ,SAVEPOINT

DATA CONTROL LANGUAGE (DCL):- GRANT,
REVOKE

(1) DATA DESCRIPTION LANGUAGE (DDL) STATEMENTS


DDL statements are used to define, alter or drop database objects. The following table gives an overview about usage of DDL statements in ORACLE.
The commands used are: -

CREATE:- Used to create table having rows and columns
ALTER:- Used to alter the structure of the database object
DELETE:- Used to delete the database objects.
RENAME:- Used to rename the database objects.

DATA MANIPULATION LANGUAGE (DML) STATEMENTS

DML statements enable users to query or manipulate data in existing objects. DML statements are normally the most commonly used commands.
The commands used are: -

DELETE:- It removes rows from the database objects
INSERT:- It adds new rows of data to database objects.
SELECT:- It retrieves data from one or more tables.
UPDATE:- It changes column values in existing rows of database objects.

DATA CONTROL LANGUAGE (DCL) STAEMENTS


The SQL sentences used to control the behavior of objects are called data control statements.
The commands used are:

GRANT:- Grant statements provide access to various tables.
REVOKE:- Revoke statement is used to deny the grant.

TRANSACTION CONTROL LANGUAGE (TCL) STATEMENTS

TCL statements manage the change made by DML statements and group DML statements into transactions. The SQL statements used to control various transactions are called transaction control statement.
The commands used are: -

COMMIT:- Make a transaction’s changes permanent.
ROLLBACK:- Undo changes in a transaction, either since the transaction started or since a save point.

Post a Comment

Previous Post Next Post