0% found this document useful (0 votes)
64 views20 pages

Ak Dbms Lab File Cse352

Uploaded by

Siddharth Tiwari
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)
64 views20 pages

Ak Dbms Lab File Cse352

Uploaded by

Siddharth Tiwari
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/ 20

** Replace the English names in the SQL queries and tables with Indian names.

**

DBMS LAB FILE


(CSE352)
Experiment 1
Implementation of DDL commands
Title: Implementation of DDL commands of SQL with suitable
examples
• Create table
• Alter table
• Drop Table
Objective: To understand the different issues involved in the design
and implementation of a database system and use data definition
language to write query for a database
Theory:
The Data Definition Language (DDL) is used to create and destroy
databases and database objects. These commands will primarily be
used by database administrators during the setup and removal
phases of a database project.
Let's take a look at the structure and usage of four basic DDL
commands:
1. CREATE
2. ALTER
a. ADD
b. MODIFY
c. DROP
d. RENAME
Procedure:
1. CREATE:
a) CREATE TABLE: This is used to create a new relation (table)

Syntax: CREATE TABLE <realtion_name/table_name>


(field_1 data_type(size),field_2 data_type(size), .. . );

Example:
SQL Query to Create the Table:

Inserting Data into the Table:


Output Example (after querying the table):

2) ALTER:
a) ALTER TABLE ….ADD….: This is used to add some extra fields into
existing relation.

Syntax: ALTER TABLE relation_name ADD (new field_1 data_type(size), new


field_2 data_type(size),..);

Example:
b) ALTER TABLE...MODIFY...: This is used to change the width as well
as data type of fields of existing relations.

Syntax: ALTER TABLE relation_name MODIFY (field_1 newdata_type(Size),


field_2 newdata_type(Size), ... field_newdata_type(Size));

Example:

c) ALTER TABLE..DROP .... This is used to remove any field of existing


relations.
Syntax: ALTER TABLE relation_name DROP COLUMN (field_name);
Example:
d) ALTER TABLE..RENAME...: This is used to change the name of fields in
existing relations.

Syntax: ALTER TABLE relation_name RENAME COLUMN (OLD field_name) to


(NEW field_name);

Example:

OUTPUT:
** Replace the English names in the SQL queries and tables with Indian names. **

DBMS LAB FILE


(CSE352)
Experiment 2
Implementation of DML commands
Title: Implementation of DML commands of SQL with suitable examples

• Insert table
• Update table
• Delete Table

Objective:

To understand the different issues involved in the design and implementation of a database system
and use data manipulation language to query, update, and manage a database.

Theory:

DATA MANIPULATION LANGUAGE (DML): The Data Manipulation Language (DML) is used to
retrieve, insert and modify database information. These commands will be used by all database users
during the routine operation of the database.

Let's take a brief look at the basic DML commands:

1. INSERT
2. UPDATE
3. DELETE

Difference between Truncate & Delete

• By using truncate command data will be removed permanently & will not get back where as
by using delete command data will be removed temporally & get back by using roll back
command.
• By using delete command data will be removed based on the condition whereas by using
truncate command there is no condition.
• Truncate is a DDL command & delete is a DML command.
PROCEDURE:
** Replace the English names in the SQL queries and tables with Indian names. **

DBMS LAB FILE


(CSE352)
Experiment 3
Implementation of Aggregate function
Title: Implementation of Aggregate functions with suitable examples.
Objective:
Develop aggregate plan strategies to assist with summarization of several data
entries.
Theory:
Aggregative operators: In addition to simply retrieving data, we often want to
perform some computation or summarization. SQL allows the use of arithmetic
expressions. We now consider a powerful class of constructs for computing
aggregate values such as COUNT, SUM, AVG, MAX and MIN.

PROCEDURE:
LET THE TABLE BE: -
** Replace the English names in the SQL queries and tables with Indian names. **

DBMS LAB FILE


(CSE352)
Experiment 4
Implementation of different types of Joins
Title:
Implementation of different types of Joins
• Inner Join
• Outer Join
• Natural Join..etc
Objective:
To implement different types of joins
Procedure: -
Let the Two tables be: -
LEFT OUTER JOIN: -

RIGHT OUTER JOIN: -


Full OUTER JOIN:-

You might also like