Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 14

By : Lohit Shetty & Dhanashree Khopkar

Types Of DB languages/Commands

DDL

DML

DCL

TCL

DDL
DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database. It is used in a generic sense to refer to any formal language for describing data or information structures. Used for the following : Creating Databases Creating Tables Drop tables Alter tables For defining primary key & foreign keys etc....

SQL
Unlike many data description languages, SQL uses a collection of imperative verbs whose effect is to modify the schema of the database by adding, changing, or deleting definitions of tables or other objects. These statements can be freely mixed with other SQL statements, so the DDL is not truly a separate language. The most commonly encountered statement is CREATE TABLE.

CREATE statements
CREATE TABLE statement CREATE TABLE [table name] ( [column definitions] ) [table parameters]. CREATE TABLE OFFICES (OFFICE INTEGER NOT NULL, CITY VARCHAR(15) NOT NULL, REGION VARCHAR(10) NOT NULL, MGR INTEGER, TARGET MONEY, SALES MONEY NOT NULL)

DROP statements
Drop - To destroy an existing database, table, index, or view. A DROP statement in SQL removes an object from a relational database management system (RDBMS). The types of objects that can be dropped depends on which RDBMS is being used, but most support the dropping of tables, users, and databases. Eg: DROP TABLE employees DROP object type object name.

ALTER statements
Alter - To modify an existing database object. An ALTER statement in SQL changes the properties of an object inside of a relational database management system (RDBMS). Eg: ALTER object type object name parameters ALTER TABLE CUSTOMERS ADD CONTACT_NAME VARCHAR(30)

ALTER TABLE SALESREPS DROP HIRE_DATE

Data Manipulation Language (DML)


DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database. Examples: SELECT, UPDATE, INSERT statements

Used for the following : retrieval of information from the database insertion of new information into the database deletion

of information in the database

modification of information in the database

Eg: SELECT * from Student_info

EG : INSERT INTO ORDERS (AMOUNT, MFR, PRODUCT, QTY, ORDER_DATE, ORDER_NUM, CUST, REP) VALUES (2340.00, 'ACI', '41004', 20, CURRENT_DATE, 113069, 2126, 111)

EG : UPDATE CUSTOMERS SET CUST_ID = 109 WHERE COMPANY = 'Acme Mfg.'

EG : DELETE FROM ORDERS WHERE CUST = 2126

DCL DCL is abbreviation of Data Control Language. It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it. GRANT , REVOKE

TCL TCL is abbreviation of Transactional Control Language. It is used to manage different transactions occurring within a database. COMMIT ROLLBACK

You might also like