Database language
Database language is defined as various forms of languages that are used to deal with the database known as database language.
There are 3 types of database language
- DDL (Data Definition Language)
- DML (Data Manipulation Language)
- DCL (Data Control Language)
DDL- It stands data definition language. DDL Statements are used to define the database structure or schema. “We specify an info schema by a collection of definition expressed by a special language known as a data-definition language (DDL)”
It is a group of SQL Commands accustomed create, modify, and delete information objects like
Tables, views, indices etc…
It is usually utilized by DBA and database engineers.
It provides command like –
command |
Description |
CREATE |
To create objects in a database |
ALTER |
To modify existing data in a table |
DROP |
To delete objects from the database |
TRUNCATE |
To remove all records from the table |
Syntax-:
To create table
CREATE TABLE tablename
(
columnName1 datatype(size),
columnName2 datatype(size),
:
: columnNameN datatype(size)
);
To alter table
Alter table TableName
Add (NewColumnName Datatype(size),
NewColumnName Datatype(size)….);
To drop table
Alter table TableName
Drop column columnName;
To truncate table
truncate table tablename;
DML- Data manipulation language are used for managing data.
It is a group of SQL Commands accustomed insert, select, update, and delete information.
command |
Description |
INSERT |
To insert data into table |
SELECT |
To retrieve data from the table |
UPDATE |
To modify existing data in the table |
DELETE |
To delete records from the table. |
Syntax-
To insert the table
insert into tablename (column1, column2, columnN)
Values (expression1, expression2, ... , expressionN);
To select the table
select * from tablename;
To update the table
update tablename set column1=expression1,column2=expression2 where condition;
To delete the table
delete from tablename;
DCL- Data Control Language is used for GRANT and REVOKE command.
command |
Description |
GRANT |
gives user's access privileges to database |
REVOKE |
withdraw access privileges given with the GRANT command |