0% found this document useful (0 votes)
156 views

Experiment - 1: DDL (Data Definition Lan-Guage) DML (Data Manipulation Language) DCL (Data Control Lan - Guage)

This document summarizes different SQL commands used for data definition (DDL), data manipulation (DML), and data control (DCL). It provides examples of DDL commands like CREATE, DROP, ALTER, TRUNCATE, COMMENT, and RENAME. Examples are also given for DML commands like INSERT, UPDATE, and DELETE. Finally, it briefly explains the DCL commands GRANT and REVOKE. The aim of the experiment is to implement these various SQL queries on Oracle or MySQL Workbench.

Uploaded by

Milan Thind
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views

Experiment - 1: DDL (Data Definition Lan-Guage) DML (Data Manipulation Language) DCL (Data Control Lan - Guage)

This document summarizes different SQL commands used for data definition (DDL), data manipulation (DML), and data control (DCL). It provides examples of DDL commands like CREATE, DROP, ALTER, TRUNCATE, COMMENT, and RENAME. Examples are also given for DML commands like INSERT, UPDATE, and DELETE. Finally, it briefly explains the DCL commands GRANT and REVOKE. The aim of the experiment is to implement these various SQL queries on Oracle or MySQL Workbench.

Uploaded by

Milan Thind
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

9th Jan 2020 Page 1

Experiment - 1
Aim - To implement different types of DDL, DML, and DCL queries.

Requirement - Oracle or MySQL Workbench

SQL Commands

DDL DML DCL


(Data Definition Lan- (Data Manipulation (Data Control Lan-
guage) Language) guage)

- CREATE - INSERT - GRANT


- DROP - UPDATE - REVOKE
- ALTER - DELETE
- TRUNCATE
- COMMENT
- RENAME

DDL(Data Definition Language)

CREATE
CREATE TABLE students(sname varchar(20), sid int, branch varchar(10));

DROP
DROP TABLE students;

ALTER
ALTER TABLE table_name DROP COLUMN column_name;
ALTER TABLE table_name MODIFY column_name column_type;
ALTER TABLE table_name ALTER COLUMN column_name column_type;
ALTER TABLE Student ADD (AGE number(3),COURSE varchar(40));
ALTER TABLE Students MODIFY COURSE varchar(20);
ALTER TABLE Students DROP COLUMN COURSE;

TRUNCATE
TRUNCATE TABLE table_name;

COMMENT
-- single line comment
/* multi line
comment */
SELECT * FROM /* Inline comment; */

DBMS Lab Milan Kamboj | 18BCS6701 | CSE-25A


Experiment - 1 Page 2

RENAME
ALTER TABLE table_name RENAME COLUMN old_name TO new_name;
ALTER TABLE table_name CHANGE COLUMN old_name TO new_name;

DML(Data Manipulation Language)

INSERT
INSERT INTO table_name VALUES (value1, value2, value3,…);

Example:
INSERT INTO students VALUES (“Milan”,6701,”CSE”);
SELECT * FROM students; (DQL)

UPDATE
UPDATE table_name SET column1 = value1, column2 = value2,... WHERE condition;

Example:
UPDATE students SET branch = “BECSE” WHERE sid = 6701;

DELETE
DELETE FROM table_name WHERE some_condition;

Example:
DELETE FROM students WHERE sid = 6701;

DCL(Data Control Language)

GRANT-gives user’s access privileges to database.


REVOKE-withdraw user’s access privileges given by using the GRANT command.

DBMS Lab Milan Kamboj | 18BCS6701 | CSE-25A

You might also like