Types of SQL queries


Types of SQL queries

Data Definition Language (DDL)

Data definition statement are use to define the database structure or table.

Statement Description
CREATE Create new database/table.
ALTER Modifies the structure of database/table.
DROP Deletes a database/table.
TRUNCATE Create new database/table.
RENAME Create new database/table.

Data Manipulation Language (DML)

Data manipulation statement are use for managing data within table object.

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.

Data Control Language (DCL)

Data control statement are use to give privileges to access limited data.

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.
COMMENT Write comment to the data table.

Transaction Control Statement (TCS)

Transaction control statement are use to apply the changes permanently save into database.

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.
SET TRANSACTION SET TRANSACTION command set the transaction properties such as read-write/read only access.

Please comment and share if you like this post and tell us about how we can enhance #dotnetcoaching to be the best online dot net tutor site. Thanks