Types of SQL Commands

Type of SQL statements are divided into five different categories: 

  1. Data definition language (DDL)
  2. Data manipulation language (DML), 
  3. Data Control Language (DCL), 
  4. Transaction Control Statement (TCS), 
  5. Session Control Statements (SCS).

DDL:(Create,Alter,Drop,Truncate,Rename)

StatementDescription
CREATECreate new database/table.
ALTERModifies the structure of database/table.
DROPDeletes a database/table.
TRUNCATERemove all table records including allocated table spaces.
RENAMERename the database/table.

DML:(Insert,Update,Delete,Merge,Lock Table,Call Explain Plan)

StatementDescription
SELECTRetrieve data from the table.
INSERTInsert data into a table.
UPDATEUpdates existing data with new data within a table.
DELETEDeletes the records rows from the table.
MERGEMERGE (also called UPSERT) statements to INSERT new records or UPDATE existing records depending on condition matches or not.
LOCK TABLELOCK TABLE statement to lock one or more tables in a specified mode. Table access denied to a other users for the duration of your table operation.
CALL
EXPLAIN PLAN
Statements are supported in PL/SQL only for executed dynamically. CALL a PL/SQL program or EXPLAIN PATH access the data path.

DCL Command:(Grant,Revoke,Analyze,Audit)


StatementDescription
GRANTGives privileges to user for accessing database data.
REVOKETake back for given privileges.
ANALYZEANALYZE statement to collect statistics information about index, cluster, table.
AUDITTo track the occurrence of a specific SQL statement or all SQL statements during the user sessions.

TCS:(Commit,Rollback,Savepoint)

StatementDescription
COMMITPermanent work save into database.
ROLLBACKRestore database to original form since the last COMMIT.
SAVEPOINTCreate SAVEPOINT for later use ROLLBACK the new changes.

SCS :(Alter Session,SET Role):


StatementDescription
ALTER SESSIONALTER SESSION statement to modify conditions or parameters that are affect to your database connection.
SET ROLESET ROLE statement to enable or disable the roles that are currently enabled for the session.

Comments