Ankush DBMSfile

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

PRACTICAL FILE

OF

DATABASE MANAGEMENT LAB

SESSION: 2023-24

SUBMITTED TO: SUBMITTED BY:


Mrs. Divya Ankush
Assistant professor
8721103
Computer Engg.
Computer Engg.

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.

DDL: DDL is an abbreviation of Data Definition Language. The DDL Commands in Structured
Query Language are used to create and modify the schema of the database and its objects. The
syntax of DDL commands is predefined for describing the data.

• 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;

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;

EXAMPLE:
RENAME Command: RENAME is a DDL command which is used to change the name of
the database table.

SYNTAX:
RENAME TABLE Old_Table_Name TO New_Table_Name;

EXAMPLE:
PRACTICAL NO: 2

AIM: Write the queries for Data Manipulation Language (DML) in RDBMS.

DML: DML commands are used to modify the database. It is responsible for all form of changes
in the database. The command of DML is not auto-committed that means it can't permanently save
all the changes in the database. They can be rollback.

• 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 Command: INSERT is 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 Command: UPDATE is 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_l, ....., column nameN = value_N]
WHERE CONDITION;

EXAMPLE:
DELETE Command: DELETE is 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.
DCL: Data control language(DCL) is used to access the stored Data. It is mainly used to
Revoke and Grant the user the required access to 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy