You are on page 1of 13

PRACTICAL FILE

OF

DATABASE MANAGEMENT LAB

2023-24 :SESSION
SUBMIITED TO: SUBMITTED BY:
Mrs Divya LATA
Assistant professor 8721126
Computer Engineering Computer Engineering

Department of Computer Engineering,


State Institute Of Engineering and Technology, Nilokheri (Karnal)

(Affiliated to Kurukshetra University, Kurukshetra)


PRACTICAL NO: 1
AIM: Write the queries for Data Definition Language (DDL) in RDBMS.

CREATE Command

DROP Command

ALTER Command

TRUNCATE Command

RENAME Command

CREATE Command: CREATE is a DDL command used to create databases, tables, triggers and other
database objects.

SYNTAX:
CREATE Database Database Name;
CREATE TABLE Table Name;

EXAMPLE:

DROP Command: DROP is a DDL command used to delete/remove the database objects from the
SQL database. We can easily remove the entire table, view, or index from the database using this
DDL command.
SYNTAX:

DROP DATABASE Database Name;


DROP TABLE Table Name;

EXAMPLE:
ALTER Command: ALTER is a DDL command which changes or modifies the existing structure of
the database, and it also changes the schema of database objects.
SYNTAX:

ALTER TABLE name of table ADD column name column definition;

EXAMPLE:

TRUNCATE Command: TRUNCATE is another DDL command which deletes or removes all records from
table. TRUNCATE also removes space allocated for storing the table records.

SYNTAX:
TRUNCATE TABLE Table Name;

RENAME Command: RENAME is a DIL command which is used to change the name of the database table.
RENAME TABLE Old Table Name TO New Table Name;
EXAMPLE:
SYNTAX:
PRACTICAL NO: 2
AIM: Write the queries for Data Manipulation Language (DML) in RDBMS.

SELECT Command

INSERT Command

UPDATE Command

DELETE Command

SELECT Command : SELECT is the most important data manipulation command in Structured
Query Language. The SELECT command shows the records of the specified table. It also shows the
particular record of a particular column by using the WHERE clause.

SYNTAX:
SELECT * FROM table name;
EXAMPLE:
INSERT: INSERT another most important data manipulation command in Structured Query
Language, which allows users to insert data in database tables.

SYNTAX:
INSERT INTO TABLE NAME (column Namel , column Name2 column NameN ) VALUES (value_l,
value_2, value N ) ;

EXAMPLE:

UPDATE UPDATE another most important data manipulation command in Structured Query
Language, which allows users to update or modify the existing data in database tables.

SYNTAX:
UPDATE Table name SET [column_namel — value 1, column nameN value_N] WHERE
CONDITION; EXAMPLE:

DELETE DELETE a DML command which allows SQL users to remove single or multiple existing
records from the database tables
This command of Data Manipulation Language does not delete the stored data permanently from
the database. We use the WHERE clause with the DELETE command to select specific rows from
the table

SYNTAX:
DELETE FROM Table Name WHERE condition;

EXAMPLE:
PRACTICAL NO: 3
AIM: Write the queries for Data Control Language (DCL) in RDBMS.
THEORY: Data control language (DCL) is used to access the stored data. It is mainly used for revoke
and to grant the user the required access to a database.

• Grant
• Revoke

GRANT Command: It is employed to grant a privilege to a user. GRANT command allows specified
users to perform specified tasks

SYNTAX:
GRANT privilege_name on object_name to user;

EXAMPLE:

REVOKE Command: It is employed to remove a privilege from a user. REVOKE helps the owner to
cancel previously granted permissions.

SYNTAX:
REVOKE privilege_name on objectname from user;

EXAMPLE:

You might also like