Top Banner
By : Lohit Shetty & Dhanashree Khopkar 
14

Ddl & Dml Final

Apr 07, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 1/14

By :

Lohit Shetty &

Dhanashree Khopkar 

Page 2: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 2/14

Page 3: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 3/14

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 formallanguage 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....

Page 4: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 4/14

Page 5: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 5/14

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)

Page 6: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 6/14

Page 7: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 7/14

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 SALESREPSDROP HIRE_DATE

Page 8: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 8/14

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

modif ication of information in the database

Page 9: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 9/14

Eg:

SELECT * from Student_info

Page 10: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 10/14

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)

Page 11: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 11/14

EG :

UPDATE CUSTOMERS

SET  CUST _ID = 109

WHERE COMPAN Y = 'Acme Mfg.'

Page 12: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 12/14

EG :

DELETE FROM ORDERS

WHERE CUST = 2126

Page 13: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 13/14

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 tomanage different transactions occurring within a database.

COMMIT

ROLLBACK

Page 14: Ddl & Dml Final

8/6/2019 Ddl & Dml Final

http://slidepdf.com/reader/full/ddl-dml-final 14/14