You are on page 1of 5

UNIVERSITY INSTITUTE OF ENGINEERING

Department of Computer Science & Engineering

Subject Name: Database Management System

Subject Code: 21CSH214

Submitted to: Submitted by:

Miss Bobbinpreet Kaur Name: Gouri Gupta

UID: 21BCS9932

Section: ON21BCS-704

Group: A
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

EXPERIMENT-1.3
Student Name: Gouri Gupta UID: 21BCS9932
Branch: CSE Section/Group: ON21BCS-704 A
Semester: 3rd Date of Performance: 15/09/22
Subject Name: DBMS Subject Code: 21CSH-214

Question 1

1. Aim: Write a PL/SQL program to find the area and perimeter of a


rectangle.

2. Objective: Implementing PL data structure to write a program for


evaluating the area and perimeter of a rectangle.

3. DBMS script and output:


SET SERVEROUTPUT ON;
DECLARE
Length NUMBER(4,2);
Breadth NUMBER(4,2);
Area NUMBER(4,2);
Perimeter NUMBER(4,2);

BEGIN
Length:=5;
Breadth:=6;
Area:=Length*Breadth;
Perimeter:=2*(Length+Breadth);

DBMS_OUTPUT.PUT_LINE('Area of rectangle is ' || Area);


DBMS_OUTPUT.PUT_LINE('Perimeter of rectangle is ' || Perimeter);
END;
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Question 2

1. Aim: Write a PL/SQL program to find odd or even number.

2. Objective: Implementing PL data structure to write a program for


evaluating whether a given number is even/odd.

3. DBMS script and output:

 When a number is even


SET SERVEROUTPUT ON;
DECLARE
n NUMBER;
r NUMBER;

BEGIN
n:=124;
r:=mod(n,2);
if (r=0) THEN
DBMS_OUTPUT.PUT_LINE('Number is Even');
else
DBMS_OUTPUT.PUT_LINE('Number is Odd');

END IF;

END;
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

 When a number is odd


SET SERVEROUTPUT ON;
DECLARE
n NUMBER;
r NUMBER;

BEGIN
n:=7;
r:=mod(n,2);
if (r=0) THEN
DBMS_OUTPUT.PUT_LINE('Number is Even');
else
DBMS_OUTPUT.PUT_LINE('Number is Odd');

END IF;

END;
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

INDEX

Ex. List of Experiments Conduct Viva Record Total Remarks/Signature


No (MM: 12) (MM: 10) (MM: 8) (MM: 30)
To implement different types
1.1 of DDL, DML, DCL queries.

To explore “SELECT”
1.2 clause using where, order by,
between, like, group by,
having etc
.
Introduction and
1.3 implementation of programs
using Block Structure and
Variables.

Introduction and
2.1 implementation of programs
using control structures If-
else statements and case
statement.

Introduction and
2.2 implementation of programs
using loops like: For, while,
Do-while.

Introduction and
2.3 implementation of programs
using Cursors.

Introduction and
2.4 implementation of programs
using Views.

Introduction and
3.1 implementation of programs
of Procedures.

Introduction and
3.2 implementation of programs
of Packages.

Introduction and
3.3 implementation of programs
of Triggers.

You might also like