SQL (Structured Query Language) is a language to work with database.
The SQL language is divided into the following four command categories:
The SQL data definition commands allow you to create, modify, and remove components of a database structure.
Typical database structure components are tables, views, indexes, constraints, synonyms, sequences, and so on.
Almost all SQL data definition commands start with one of the following three keywords:
For example, with the CREATE VIEW command, you can create views.
With the ALTER TABLE command, you can change the structure of a table, for example by adding, renaming, or dropping a column.
With the DROP INDEX command, you can drop an index.
SQL data manipulation commands allow you to change the contents of your database.
SQL offers three basic data manipulation commands:
You can add rows to a table with the INSERT command in two ways.
DELETE empties a table; DROP removes a table.
TRUNCATE allows you to delete all the rows in a table in an efficient (but irrevocable) way.
UPDATE changes the contents of a table; ALTER changes its structure.
Data manipulation commands are always treated as being part of a transaction.
All database changes caused by SQL data manipulation commands get a pending status until you confirm (commit) or cancel (roll back) the transaction.
No one, except the transaction itself, can see the pending changes of a transaction before it is committed.
SQL offers two commands to control your transactions explicitly:
Sometimes, transactions are committed implicitly without any explicit request from a user.
For example, every data definition command (like CREATE, DROP, TRUNCATE etc.) implicitly commits your current transaction.