Types of statements in SQL: data definition, manipulation, transaction, access control, programmatic

A statement is an action which has to be performed in the database. A SQL statement starts with a verb as a keyword like CREATE, INSERT, etc. Then there’s the clause which specifies the data for which the statement is executed. After that there’s another keyword like FROM, WHERE, etc. Clauses can be optional or required.

A typical SQL statement has the following structure:


SELECT: is a verb. It is also a keyword.

NAME: is column name.

EMPLOYEES: is name of table. It is also a clause.

WHERE: is a keyword.

EMPL_N: is column name.

1020: is a constant. It is also a clause.

Types of statements used in SQL:

For data definition:

  • CREATE TABLE: For adding a new table to database.
  • ALTER TABLE: To change structure of a table.
  • DROP TABLE: For removing a table from database.
  • CREATE VIEW: For adding a new view to database.
  • DROP VIEW: For removing a view from database.
  • CREATE INDEX: For building an index for a column.
  • DROP INDEX: For removing index for a column.
  • CREATE SCHEMA: For adding a new schema to database.
  • DROP SCHEMA: For removing a schema from database.
  • CREATE DOMAIN: For adding a new data value domain.
  • ALTER DOMAIN: For modifying a domain definition.
  • DROP DOMAIN: For removing a domain from database.

For data manipulation:

  • SELECT: For retrieving data from database.
  • INSERT: For adding new rows of data to database.
  • DELETE: For removing rows of data from database.
  • UPDATE: For modifying data of database.

For transaction control:

  • COMMIT: To end current transaction.
  • ROLLBACK: To abort current transaction.
  • SET TRANSACTION: For defining data access characteristics of current transaction.
  • For access Control:
  • GRANT: To grant user access privileges.
  • REVOKE: To remove user access privileges.

Programmatic SQL statements:

  • OPEN: To open a cursor to retrieve query results.
  • CLOSE: To close a cursor.
  • FETCH: To retrieve a row of query results.
  • DECLARE: To define a cursor for a query.
  • EXPLAIN: To describe data access plan for a query.
  • PREPARE: To prepare a SQL statement for dynamic execution.
  • EXECUTE: To execute a SQL statement dynamically.
  • DESCRIBE: To describe a prepared query.

Leave a Reply