What is SQL?
SQL means structured Query Language. It is the default language of Oracle. It enables you to create and operate on relational database in which data is stored in the form of tables.
SQL commands can be categorized into following types.
- DDL (Data Definition Language)
- DML(Data Manipulation Language)
- TCL (Transaction Control Language)
- DCL (Data Control Language)
1. DDL (Data Definition Language)
DDL statements are used to create, modify or delete the structure of a database. Using DDL we can specify the type, size and domain of data to be stored in database. We can also specify the length of data.
These statements also provide the way to check errors and to apply constraints so that only correct data should be entered into the database.
DDL commands provided by Oracle are:-
-
- Create Table
- Alter Table
- Drop Table
2. DML(Data Manipulation Language)
DML statements are used to add, modify, delete or view records from a database table. DML statements are of two types.
-
- Procedural DML
- Non Procedural DML
Procedual DML
In procedural DML we need to specify what data is needed and how it should be retrieved.
Non Procedural DML
In Non Procedural DML we need to specify what data is needed not how to retrieve it.
The various DML commands are
(I) Insert
(II) Update
(III)Delete
(IV) Select
3 TCL(Transaction Control Language)
TCL statements are used to commit or undo the various transactions on a database table. Various TCL commands are
(I) COMMIT
(II) ROLLBACK
(III) Savepoint
4. DCL (Data Control Language)
DCL statements are used to assign or revoke privileges of objects belonging to one user to another user. If a user wishes to access any of the objects belonging to another user, the owner of object will have to give permissions to him/her for such an access This is called granting of privileges. Privileges granted can be taken back by the owner. This is called revoking of privileges.
Various DCL statements provided by Oracle are
(I) Grant
(II) Revoke