Professional Documents
Culture Documents
DDL & DML Final
DDL & DML Final
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)
Used for the following : retrieval of information from the database insertion of new information into the database deletion
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)
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