Database languages in Dbms.

Database language in Dbms:

The database system provides languages to specify the database schema. The database language in DBMS is classified into DDL, DML, DCL, and TCL.

 

Database languages in Dbms

 

DDL Commands:

It is a data definition language used to specify the database schema with a set of definitions.

Commands of DDL:

        • Create
        • Alter
          1.  Add
          2.  Modify
          3.  Drop
        • Rename
        • Drop
        • Truncate

 

CREATE:

The command is used for creating tables.

Syntax:

Create table <table name> (column name1 data type (size) constraints, column2 data type (size),.., column name N data type(size));

 

ALTER:

The command is used for modifying the structure of tables.

a) ADD:

To add a column in a table.

Syntax:

Alter table <table name> add(column name1 datatype1);

b) MODIFY:

To modify the data type of a column in a relation.

Syntax:

Alter table <table name> modify(column name1 datatype1);

c) DROP:

To delete a column in a table.

Syntax:

Alter table <table name> drop (column name);

 

RENAME:

The command is used to rename the table.

Syntax:

Rename table table_name TO new_table_name;

 

DROP:

The command is used for removing an existing table.

Syntax:

Drop table table_name;

 

TRUNCATE:

The command removes all the records in the table and not the table itself.

Syntax:

Truncate table <table name>;

 

DML Commands:

This language is used to manipulate the relation.

INSERT: 

This inserts the value into the relation.

Syntax 1: Insert into <table name> values (‘attributes1’, ’attributes2’……);

Syntax 2: Insert into<table name>(column names)values(list of data values);

Syntax 3: Insert into <table name>values(&columname1,&columnname2…);

 

SELECT:

It selects certain tuples in a relation.

Syntax 1:Select column name1,columnname2 from <table name>;

Syntax 2: Select * from <tablename>;

 

UPDATE:

Syntax:

Update <table name> set <column name>=’values’ where <condition>;

 

DELETE:

Syntax:

Delete from <table name>;

 

TCL Commands:

It is a transaction control language that is used to control the transactions made by the relations.

COMMIT:

Syntax:

Commit:

 

ROLLBACK:

Syntax:

Rollback;

DCL Commands:

It is the data control language used to provide or take back permission from the users.

GRANT:

It grants permission to the users.

Syntax:

grant;

 

REVOKE:

It revokes permission from the users.

Syntax:

revoke;

 

Also, read What sequence of regular instructions could be used to do the same thing?

 

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *