Types of SQL Commands
Type of SQL statements are divided into five different categories:
- Data definition language (DDL)
- Data manipulation language (DML),
- Data Control Language (DCL),
- Transaction Control Statement (TCS),
- Session Control Statements (SCS).
DDL:(Create,Alter,Drop,Truncate,Rename)
| Statement | Description |
|---|---|
| CREATE | Create new database/table. |
| ALTER | Modifies the structure of database/table. |
| DROP | Deletes a database/table. |
| TRUNCATE | Remove all table records including allocated table spaces. |
| RENAME | Rename the database/table. |
DML:(Insert,Update,Delete,Merge,Lock Table,Call Explain Plan)
| Statement | Description |
|---|---|
| SELECT | Retrieve data from the table. |
| INSERT | Insert data into a table. |
| UPDATE | Updates existing data with new data within a table. |
| DELETE | Deletes the records rows from the table. |
| MERGE | MERGE (also called UPSERT) statements to INSERT new records or UPDATE existing records depending on condition matches or not. |
| LOCK TABLE | LOCK 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)
| Statement | Description |
|---|---|
| GRANT | Gives privileges to user for accessing database data. |
| REVOKE | Take back for given privileges. |
| ANALYZE | ANALYZE statement to collect statistics information about index, cluster, table. |
| AUDIT | To track the occurrence of a specific SQL statement or all SQL statements during the user sessions. |
TCS:(Commit,Rollback,Savepoint)
| Statement | Description |
|---|---|
| COMMIT | Permanent work save into database. |
| ROLLBACK | Restore database to original form since the last COMMIT. |
| SAVEPOINT | Create SAVEPOINT for later use ROLLBACK the new changes. |
SCS :(Alter Session,SET Role):
| Statement | Description |
|---|---|
| ALTER SESSION | ALTER SESSION statement to modify conditions or parameters that are affect to your database connection. |
| SET ROLE | SET ROLE statement to enable or disable the roles that are currently enabled for the session. |
Comments
Post a Comment