Updated ADBMS Practical IA

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Directorate of Online Education

Manipal University Jaipur


Internal Assessment

Program: MCA
Subject: Advance Database Management System – Practical
Course Code: DCA6131
Maximum Marks: 70
Practical Assignment start date: 16/09/2021
Practical Assignment submission date 30/09/2021

PRACTICAL EXAM INSTRUCTIONS -

1. The Internal practical examination contains 5 questions.


2. 14 mark(s) will be awarded for each correct answer.
3. All questions need to be attempted.

Problem Statement 1

Exercise Objective: The objective of this exercise is to enable you to understand SQL
relational concepts – Primary Key and Foreign Key and the concept of normalization

Problem Statement 1: Consider the Insurance database given below. The primary keys
are underlined, and the data types are specified:

PERSON (driver – id #: String, name: string, address: string)


CAR (regno: string, model: string, year: int)
ACCIDENT (report-number: int, accd-date: date, location: string)
OWNS (driver-id #:string, Regno :string)
PARTICIPATED (driver-id:string,Regno:string,report-number:int,damage
mount:int)

Create the above tables by properly specifying the primary keys and the foreign keys.
Enter at least five tuples for each relation. Display the details of the people and their
cars that were involved in accidents in certain years (say 2008).
Instructions

-Write comment to make your PL/SQL code readable.


-Use descriptive variables in your PL/SQL code (Name of the variables shou ld show their
purposes).

- Ensure your PL/SQL code compiles without any errors/warning/deprecations

- Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

- Always test the PL/SQL code thoroughly, before saving/submitting exercises/project.

Hints/ Tips:

The steps for this exercise are given below:

Step – 1: Start

Step – 2: Create Database, tables using CREATE commands with its essential attributes.

Step – 3: Insert the values using INSERT INTO statements. (Insert the suitable values
(tuples) so that queries are executed correctly.)

Step – 4: Execute different Commands and extract information from the table. (Hint: use
keywords like PRIMARY, FOREIGN, FROM, WHERE, DISTINCT, MINUS, GROUP BY,
ORDERBY etc. You can use suitable operators like AND & OR for certain conditions to
meet)

Step – 5: Execute and check.

Expected Output:

Creation of database, tables with the use of primary keys, foreign keys and its
extraction/modification of required data through SQL commands.

Credentials Used for Exercise 1:


Host = mysql-muj-db.czgqnp6ru8hk.ap-south-1.rds.amazonaws.com

Name = DB_rollnumber

Username = rollnumber

password = rollnumber

Port = 3306
Problem Statement 2

Exercise Objective: The objective of this exercise is to enable you to understand and use
SQL relational concepts along with the concepts of Joins.

Problem Statement 2: Consider the following database of student enrollment


in courses & books adopted for each course:

STUDENT (regno: string, name: string, major: string, bdate:date)

COURSE (course #:int, cname:string, dept:string)

ENROLL ( regno:string, course#:int, sem:int, marks:int)

BOOK _ ADOPTION (course# :int, sem:int, book-ISBN:int)

TEXT (book-ISBN:int, book-title:string, publisher:string, author:string)

Create the above tables by properly specifying the primary keys and the foreign keys.
Enter at least five tuples for each relation.
Illustrate inner join, Left join, right join, by joining STUDENT and ENROLL table.
And also List any department that has all its adopted books published by a specific
publisher.
Instructions

- Write comment to make your PL/SQL code readable.

- Use descriptive variables in your PL/SQL code (Name of the variables shou ld show their
purposes).

- Ensure your PL/SQL code compiles without any errors/warning/deprecations

- Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

- Always test the PL/SQL code thoroughly, before saving/submitting exercises/project.

Hints/ Tips:

The steps for this exercise are given below:

Step – 1: Start

Step – 2: Create Database, tables using CREATE commands with its essential attributes.
Step – 3: Insert the values using INSERT INTO statements. (Insert the suitable values
(tuples) so that queries are executed correctly.)

Step – 4: Execute different Commands and extract information from the table. (Hint: use
keywords like PRIMARY, FOREIGN, FROM, WHERE, DISTINCT, MINUS, GROUP BY,
ORDERBY etc. You can use suitable operators like AND & OR for certain conditions to
meet)

Step – 5: Execute and check.

Expected Output:

Creation of database, tables with the use of primary keys, foreign keys and its
extraction/modification of required data through SQL commands.

Credentials Used for Exercise 2:


Host = mysql-muj-db.czgqnp6ru8hk.ap-south-1.rds.amazonaws.com

Name = DB_rollnumber

Username = rollnumber

password = rollnumber

Port = 3306
Problem Statement 3
Exercise Objective: The objective of this program is to enable you to use the Pl/SQL block.
Problem Statement 3: Write a PL/SQL code block that will calculate the sum of two
given numbers x = 5 and y = 9.

Instructions
- Write comment to make your PL/SQL code readable.

- Use descriptive variables in your PL/SQL code (Name of the variables shou ld show their
purposes).

- Ensure your PL/SQL code compiles without any errors/warning/deprecations

- Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

- Always test the PL/SQL code thoroughly, before saving/submitting exercises/project.

Hints/ Tips:

Expected Output
declare
-- declare variable x, y
-- and z of datatype number
begin
--Assign values to variables
z:=x+y;
-- Print the Result
dbms_output.put_line(………….);
end;
/
Expected Output: Display the Sum

Credentials Used for Exercise 3:


 Host :- oracle-muj.cmmtocbvzm4p.ap-southeast-1.rds.amazonaws.com 
Name :- muj
Username :- maitdbuser
Password :- 1tKP&th3m
Problem Statement 4

Exercise Objective: The objective of this exercise is to enable you to use while loop in
PL/SQL.

Problem Statement 4: Write a PL/SQL block to display the reverse of a given


number x= 243.
Instructions

- Write comment to make your PL/SQL code readable.

- Use descriptive variables in your PL/SQL code (Name of the variables shou ld show their
purposes).

- Ensure your PL/SQL code compiles without any errors/warning/deprecations

- Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

- Always test the PL/SQL code thoroughly, before saving/submitting exercises/project.

Hints/ Tips:

DECLARE
-- declare variable x
BEGIN
num:= 243;
rev:=0;
WHILE num>0 LOOP
-- Execution statements
END LOOP;
DBMS_OUTPUT.PUT_LINE(………………………….);
END;

Expected Output: Display the reverse of a number.

Credentials Used for Exercise 4:


 Host :- oracle-muj.cmmtocbvzm4p.ap-southeast-1.rds.amazonaws.com 
Name :- muj
Username :- maitdbuser
Password :- 1tKP&th3m
Problem Statement 5

Exercise Objectives: The objective of this exercise is to enable you to make use of
If construct in PL/SQL.

Problem Statement 5: Write a program to find greatest of three given numbers a= 10,
b= 12, c= 5.

Instructions

- Write comment to make your PL/SQL code readable.

- Use descriptive variables in your PL/SQL code (Name of the variables shou ld show their
purposes).

- Ensure your PL/SQL code compiles without any errors/warning/deprecations

- Avoid too many & unnecessary usage of white spaces (newline, spaces, tabs, …)

- Always test the PL/SQL code thoroughly, before saving/submitting exercises/project.

Hints/ Tips:

Declare
-- declare variable a,b,c

begin
dbms_output.put_line('a='||a||' b='||b||' c='||c);
if condition AND condition
then
dbms_output.put_line('a is greatest');
else
…………………
end if;
end;

Expected Output: Display the greatest number.

Credentials Used for Exercise 5:


 Host :- oracle-muj.cmmtocbvzm4p.ap-southeast-1.rds.amazonaws.com 
Name :- muj
Username :- maitdbuser
Password :- 1tKP&th3m

You might also like