page contents

About the Post

Author Information

Language components of Structured Query Language (SQL)

Recently, I have been working on improving my querying ability in Microsoft SQL and have been reading Itzik Ben-Gan’s book. I thought I had written this topic in an earlier and to my surprise I was wrong. A good fundamental bit of information to know as I progress through data structures and the language used to retrieve or modify data.

DDL- Data Definition Language- http://technet.microsoft.com/en-us/library/ff848799.aspx

These kind of statements are used to define database structure or schema.

  • ALTER – This statement is used to change/edit objects in the database
  • CREATE – This statement is used to create objects in the database
  • DISABLE TRIGGER – This statement is used to disable a trigger, but it does not drop it. The trigger still exists as an object in the current database. However, the trigger does not fire when any Transact-SQL statements on which it was programmed are executed
  • DROP – This statement is used to delete objects fully from the database
  • ENABLE TRIGGER – This statement is used to enable a trigger, but it does not re-create it. The trigger still exists as an object in the current database and when enabled it will fire when any Transact-SQL statements on which it was programmed are executed
  • TRUNCATE TABLE – This statement removes all rows from a table without logging the individual row deletions. TRUNCATE TABLE is similar to the DELETE statement with no WHERE clause; however, TRUNCATE TABLE is faster and uses fewer system and transaction log resources
  • UPDATE STATISTICS – This statement is used to update statistics

DML – Data Manipulation Language – http://technet.microsoft.com/en-us/library/ff848766.aspx

This kind of statements are used to retrieve, store, modify, delete, insert and update data in database. These commands are used to retrieve and manipulate data in a relational database aka CRUD (create, read, update and delete) and another variation of CRUD is BREAD, an acronym for “Browse, Read, Edit, Add, Delete”.

  • SELECT -This statement is used to retrieve data from the Table
  • INSERT -This statement is used to insert data to the Table
  • UPDATE – This statement is used to update data in the Table
  • DELETE – This statement is used to delete data from the Table

DCL – Data Control Language- http://technet.microsoft.com/en-us/library/ff848791.aspx

This kind of statements are used to create roles, permissions, and referential integrity. And it can be used to control access to database for security purpose. (used to control access to data stored in a database)

  • GRANT – This statement is used to give access privileges to database users.
  • REVOKE – This statement is used to withdraw access privileges.

TCL – Transactional Control Language- http://technet.microsoft.com/en-us/library/ms174377.aspx

This kind of statements are used to manage different transactions occurring within a database (Like changes made by executing DML statements ) . It allows statements to be grouped together into logical transactions.

  • COMMIT – This statement is used to execute the changes permanently.
  • ROLLBACK – This statement is used to restore database to original data from since the last COMMIT statement

Tags: , , , , , , ,

Comments are closed.

Copy Protected by Chetan's WP-Copyprotect.