The main components of sql are :
- Data Definition Language
- Data Manipulation Language
- Data Control Language
- Query Language
- Transaction Control Language
Data Definition Language (DDL) : Tables are the only way to store data, there fore all the information has to be arranged in the form of tables.
Suppose you want to store some information about the company in the database.
To store this data, you first need to create table. You can create table by using the create table command.
create table Company (cname char(10), city char(10));
This statement is a part of a DDL. You can also create other objects, such as index and views by using a DDLstatements. Using DDL, you can also drop or alter objects.
Data Manipulation Language (DML) : DML, as the name suggests, allows you to manipulate data in an existing table.Using DML, you can carry out various operations , sucha as insertion, updation, deletes on a table.
Adding ROW to a Table
insert into Company ('ACC', 'Hyderabad');
Update a record in an existing Table
update Company set city = 'Mumbai' where canme = ' ACC';
delete company where cname = 'Acc'
Query Language : The query language is also a part of DML, and is used to retrieve data from table.
Select * from Company;
Data Control Language DCL: DL allows you to control access to the data. It grants permissions to a user to access and manipulate data. The following are the statements of DCL:
Grant : Grants permissions to one or more users to perform an operation or a set of operations on an object.
Revoke: withdraws the access permissions given by the GRANT statement.
Transactional control language TCL: Transactional statement include commit, rollback and save points. the session control statement is used to change session level parameters,like default date formats and numeric formats. The system control statements are used to change system-wide parameters, like memory allocation.