0% found this document useful (0 votes)
68 views54 pages

Database Management Systems ESA Dec 2024

The document outlines the End Semester Assessment (ESA) for the Database Management Systems course at PES University, detailing various questions and tasks related to database concepts, including ER models, relational algebra, SQL queries, functional dependencies, and transaction management. It includes specific questions on designing ER diagrams, writing SQL queries, and explaining database principles and normalization forms. The assessment aims to evaluate students' understanding of database systems and their practical applications.

Uploaded by

shruthanaj
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)
68 views54 pages

Database Management Systems ESA Dec 2024

The document outlines the End Semester Assessment (ESA) for the Database Management Systems course at PES University, detailing various questions and tasks related to database concepts, including ER models, relational algebra, SQL queries, functional dependencies, and transaction management. It includes specific questions on designing ER diagrams, writing SQL queries, and explaining database principles and normalization forms. The assessment aims to evaluate students' understanding of database systems and their practical applications.

Uploaded by

shruthanaj
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

3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351AX (set- 1)

PES University, Bengaluru


(Established under Karnataka Act 16 of 2013)

END SEMESTER ASSESSMENT (ESA) - Dec 2024

UE22CS351A. - DATABASE MANAGEMENT SYSTEMS

Total Marks : 100.0

1.a. Draw an ER model of the Banking database application considering


the following constraints −
· A bank has many entities.
· Each customer has multiple accounts.
· Multiple customers belong to a single branch.
· Single customer can borrow multiple loans.
· A branch has multiple employees.
(8.0 Marks)

1.b. What are the different types of relationships in an E-R diagram?


Explain each with example (6.0 Marks)

1.c. Exemplify the steps of mapping from E-R diagram into a relational
model? (5.0 Marks)

about:blank 1/7
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351AX (set- 1)

1.d. Explain the different levels of data abstraction in a Database system


with a neat diagram. Also state logical data independence and physical
data independence. (6.0 Marks)

2.a. Suppose there is a banking database which comprises following


tables :
Customer(Cust_name, Cust_street, Cust_city)
Branch(Branch_name, Branch_city, Assets)
Account (Branch_name, Account_number, Balance)
Loan(Branch_name, Loan_number, Amount)
Depositor(Cust_name, Account_number)
Borrower(Cust_name, Loan_number)
Write the Relational Algebric expression for the following queries:
i. Find the names of all the customers who have taken a loan from the
bank and also have an account at the bank(3M)
ii. List the Customer details whose account balance is greater than
Rs50000 of "PES" Branch (3M) (6.0 Marks)

about:blank 2/7
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351AX (set- 1)

2.b. Consider the following table:

Write the SQL Query for the following queries:


i. To retrieve the names and salaries of employees who earn more than
$10,000.
ii. To List all employees hired after January 1, 2020, along with their hire
date.
iii. To retrieve the names of employees along with their department
names.

(6.0 Marks)

2.c. What are integrity constraints in SQL? Explain the different types of
constraints (PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK)
with examples. (10.0 Marks)

about:blank 3/7
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351AX (set- 1)

2.d. What do you mean by views in SQL? Is the view table contents are
precomputed and stored? Illustrate views with an example (3.0 Marks)

3.a. What is the process to determine whether the given two sets of
Functional dependencies, say F and G are Equivalent?(3M)
Consider the relation R(A,B,C,D) having two FD sets
FD1 = {A->B, B->C,A->C} and
FD2 = {A->B, B->C, A->D}.
Determine whether FD1 and FD2 are Equivalent in detailed list of steps.
(5M) (8.0 Marks)

3.b. Give the algorithm to find the minimal cover of a set of functional
dependencies.(2M)
Find the minimal cover of the set of functional dependencies given;
{A → C, AB → C, C →DI, CD → I, EC → AB, EI → C} (5M) (7.0 Marks)

about:blank 4/7
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351AX (set- 1)

3.c. Illustrate and explain the first normal form(1NF), general definition of
second normal form (2NF) and general definition of third normal
form(3NF) with an example for each of them. (6.0 Marks)

3.d. Exemplify the Properties of Relational Decompositions with proper


explanation. (4.0 Marks)

4.a. How are the deadlocks identified in concurrent transactions?


Explain the two schemes for preventing deadlocks? (4.0 Marks)

about:blank 5/7
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351AX (set- 1)

4.b. What is the Two Phase Locking technique? (1M).


Comapre and contrast between Strict two phase locking and Rigorous two
phase locking.(4M) (5.0 Marks)

4.c. Consider the below given schedule and check whether the given
schedule is conflict serializable by listing all the conflicting operations and
drawing the precedence graph.
(4.0 Marks)

4.d. Explain neo4j data model and write the following queries using neo4j-
cypher query language (4M)
i. create a node with label ‘Book’ and a set of properties as follows:
title: Database
edition: seven
publisher: pearson (2M)
ii. Update the title of the book from ‘Database’ to ‘Database system’(1M)
iii. Remove the node with the label book if the title is ‘Database
system’(1M) (8.0 Marks)

about:blank 6/7
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351AX (set- 1)

4.e. Differentiate between SQL and NoSQL databases. (4.0 Marks)

about:blank 7/7
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

PES University, Bengaluru


(Established under Karnataka Act 16 of 2013)

END SEMESTER ASSESSMENT (ESA) - Dec 2024

UE22CS351A - Database Management System

Total Marks : 100.0

1.a. Discuss the main characteristics of the database approach and how it
differs from traditional file systems. (5.0 Marks)

about:blank 1/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

1.b. Consider a CONFERENCE_REVIEW database in which researchers


submit their research papers for consideration. Reviews by reviewers are
recorded for use in the paper selection process. The database system
caters primarily to reviewers who record answers to evaluation questions
for each paper they review and make recommendations regarding
whether to accept or reject the paper. The data requirements are
summarized as follows:
Authors of papers are uniquely identified by e-mail id. First and last
names are also recorded.
Each paper is assigned a unique identifier by the system and is
described by a title, abstract, and the name of the electronic file
containing the paper.
A paper may have multiple authors, but one of the authors is
designated as the contact author.
Reviewers of papers are uniquely identified by e-mail address. Each
re viewer’s first name, last name, phone number, affiliation, and
topics of interest are also recorded.
Each paper is assigned between two and four reviewers. A reviewer
rates each paper assigned to him or her on a scale of 1 to 10 in four
categories: technical merit, readability, originality, and relevance to
the conference. Finally, each reviewer provides an overall
recommendation regarding each paper.
Each review contains two types of written comments: one to be seen
by the review committee only and the other as feedback to the
author(s).
Design an entity–relationship diagram for the CONFERENCE_REVIEW data
base with minmax notation representing entities, primary keys,
relationships, cardinality ratio and participation constraint. (10.0 Marks)

1.c. What is meant by a recursive relationship type? Give any two


examples of recursive relationship types. List any two cases where use of
a recursive relationship would be appropriate. (5.0 Marks)

about:blank 2/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

1.d. Explain the steps in converting an ER diagram to a relational schema ?


Mention how weak entities, one to one relationship, one to many
relationship, many to many relationship and multivalued attributes are
handled in relational mapping. (5.0 Marks)

about:blank 3/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

2.a. Consider the Publication Database Schema


Author (author_id, first name, last name)
Author_pub (author id, pub_id, author_position)
Book (book_id, book_title, month, year, editor)
pub (pub_id, title, book_id)
authorid in author pub is a foreign key referencing author
pubid in author pub is a foreign key referencing pub
bookid in pub is a foreign key referencing book
editor in book is a foreign key referencing Author (authorid)
Primary keys are underlined

Answer the following questions


1. Interpret the meaning and the ouput of the following expression.

2. Interpret the meaning and the output of the following expression.

3. Write a relational algebra expression that returns the names of all


authors who are book editors.
4. Write a relational algebra expression that returns the names of all
authors who are not book editors.
(6.0 Marks)

about:blank 4/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

2.b. Consider the following tables


Highschooler(ID int primary key, name text, grade int) - Represents
students with attributes ID, name, and grade
Friend(ID1 int, ID2 int)- Represents friendships between students using
ID1 and ID2
Likes(ID1 int, ID2 int) - Represents who likes whom, using ID1 and ID2.
1. Write a trigger to enforce the following behavior:If A liked B but is
updated to A liking C instead, and B and C were friends, make B and
C no longer friends. Don't forget to delete the friendship in both
directions, and make sure the trigger only runs when the "liked" (ID2)
person is changed but the "liking" (ID1) person is not changed.
2. Create a procedure that returns a list of friends for a given
highschooler, along with their current likes. The output should be in
the below format.
FriendID | FriendName | LikedPersonID | LikedPersonName.
The procedure has to find out the list of friends and his current
likes if the ID of the highschooler is ‘1001’ (8.0 Marks)

about:blank 5/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

2.c.

Consider the above mentioned supplier database and its state.


The primary key of each table is indicated by underlining the constituent
fields.

Determine the number of rows and the output for each SQL query given
below.
1. SELECT AVG (cost) FROM Catalogue WHERE pno = ‘P4’ GROUP
BY(pno);
2. SELECT [Link],[Link] FROM Supplier s , Catalogue c WHERE cost>
(SELECT AVG (cost) FROM Catalogue WHERE pno = ‘P4’ GROUP
BY(pno));
3. SELECT [Link],[Link] FROM Supplier s , Catalogue c WHERE
[Link]=[Link];
4. SELECT [Link], [Link],[Link],[Link] FROM Suppliers s,
Catalogue c WHERE [Link]=[Link] AND [Link] > (SELECT AVG (cost)
FROM Catalogue WHERE pno = 'P4' GROUP BY(pno)) ;
(4.0 Marks)

about:blank 6/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

2.d. Consider a ROYAL_FAMILY_MEMBERS table that stores information


about members of a royal family, including each member’s unique ID,
name, and parent ID (indicating their immediate ancestor). The table is
created as follows:

create table ROYAL_FAMILY_MEMBERS(id int primary key,name


varchar(20),parentid int references ROYAL_FAMILY_MEMBERS(id));

Write a SQL query using a Common Table Expression (CTE) to retrieve


the entire ancestry of a member named 'Krish', starting from Krish and
moving upwards through the family tree until the root ancestor. The
query should return all ancestors of 'Krish’, including Krish himself, with
each ancestor’s ID, name, and parent ID. (7.0 Marks)

3.a. Suppose, a relational schema R (v,w,x,y,z) and set of functional


dependencies F and G are as follow:

Check whether the set of functional dependencies F and G are equivalent


(6.0 Marks)

3.b. Consider the following set of functional dependencies F on a relation


R={A,B,C,D,E}

.
Find the minimal cover of the given set of functional dependencies F.
(6.0 Marks)

about:blank 7/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

3.c. Consider the following four relational schemas. For each schema, all
non-trivial functional dependencies are listed. The underlined attributes
are the respective primary keys.

Which one of the above relational schema is in 3NF but not in BCNF?
Justify (8.0 Marks)

3.d. Suppose that we decompose the schema R = (A, B, C, D, E) into two


relations R1(A, B, C) and R2 (A, D, E). Show that this binary decomposition
is a lossless decomposition if the following set F of functional
dependencies holds:
A ->BC, CD -> E, B -> D, E -> A (5.0 Marks)

about:blank 8/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

4.a. Consider the read and write operations respectively on a data item x
and y by a transaction T1 and T2. Consider the following two schedules S1
and S2
Schedule S1 Schedule S2

Determine whether the schedule s1 and s2 are conflict serializable or not


(4.0 Marks)

4.b. Identify the appropriate minimum transaction isolation level for the
scenarios described below. Justify your choice by explaining the specific
problem that arises in each case.
Scenario 1:
A bank application allows two clerks to update the balance of a
customer’s account simultaneously. The current balance is ₹10,000.
Clerk A withdraws ₹5,000 and Clerk B deposits ₹3,000.
Both transactions execute at the same time.
Scenario 2:
In a university database, Transaction 1 queries the list of students in a
class. Before Transaction 1 completes, Transaction 2 adds a new student
and commits.
Transaction 1 re-queries and finds a new student in the list.
How can you prevent this inconsistency?
Scenario 3:
A retail system has two transactions:
Transaction 1 updates a product's stock quantity but is not yet
committed.
Transaction 2 reads the stock quantity to place an order.
If Transaction 1 is rolled back, but Transaction 2 already used the
uncommitted data, what could happen? Which isolation level can prevent
this?

Scenario 4:
A sales application reads the price of a product in Transaction 1. Before
Transaction 1 completes, Transaction 2 updates the price and commits.
Transaction 1 reads the price again and finds it has changed.
Which isolation level would prevent this issue?
(8.0 Marks)

about:blank 9/10
3/25/25, 4:04 PM ESA - Dec 2024 - UE22CS351A (set- 1)

4.c. Consider a database named libraryDB with the following collections:


books: title, author, copies: Stores information about books.
members: name, membership type(premium/regular)Stores information
about library members.
borrowedBooks: memberID, borrdate, returndate .Stores details of
borrowed books.
Write mongodb query to
1. Find all books with more than 3 copies available.
2. List the names of all premium members.
3. Find books borrowed between specific dates.
4. Fetch the number of borrowed books.
(8.0 Marks)

4.d. Consider Neo4j Database: Movie Recommendation System


Assume a Neo4j database containing nodes and relationships related to
movies, actors, directors, and users. The following labels and
relationships are used:
Labels: Movie, Actor, Director, User
Relationships:
(:Actor)-[:ACTED_IN]->(:Movie)
(:Director)-[:DIRECTED]->(:Movie)
(:User)-[:RATED]->(:Movie)
1. Find all movies acted in by a specific actor (e.g., "Leonardo DiCaprio")
2. List all actors who acted in movies directed by "Christopher Nolan".
3. Find all users who have rated any movie.
(5.0 Marks)

about:blank 10/10
3/25/25, 4:26 PM ESA - Dec 2024 - UE21CS351A (set- 1)

PES University, Bengaluru


(Established under Karnataka Act 16 of 2013)

END SEMESTER ASSESSMENT (ESA) - Dec 2024

UE21CS351A - Database Management System

Total Marks : 100.0

1.a. What is Database Management System? Explain in details. (5.0 Marks)

1.b. How the file processing is so complex? how the database overcomes
the limitations in the file processing system? (5.0 Marks)

1.c. Discuss in details about data independence. (7.0 Marks)

about:blank 1/5
3/25/25, 4:26 PM ESA - Dec 2024 - UE21CS351A (set- 1)

1.d. What are keys in DBMS? Describe. (8.0 Marks)

2.a. What are aggregate functions? Illustrate it. (5.0 Marks)

2.b. What are the set operations? Illustrate with sql query. (7.0 Marks)

about:blank 2/5
3/25/25, 4:26 PM ESA - Dec 2024 - UE21CS351A (set- 1)

2.c. Illustrate nested query in select clause, from clause, and from where
clause. (8.0 Marks)

2.d. what is trigger? Create a trigger that checks if the entered marks are
valid or not whenever an entry is made in the Marks_sample table.
(5.0 Marks)

3.a. Show that the following two sets of FDs are equivalent:
F = {A → C, AC → D, E → AD, E → H} and
G = {A → CD, E → AH}
Which of the following holds true?
(A) G ⊇ F
(B) F ⊇ G
(C) F = G
(D) All of the above (15.0 Marks)

about:blank 3/5
3/25/25, 4:26 PM ESA - Dec 2024 - UE21CS351A (set- 1)

3.b. What is 3NF? Consider the following scheme, key and FDs. Check the
table is in 3NF. If not, convert into 3NF.
Scheme = {Title, PubID, PageCount, Price }
[Link] -> {Title, PubId}
2.{Title, PubId} -> {PageCount}
3.{PageCount} -> {Price} (10.0 Marks)

4.a. What is NoSQL database? Discuss various NoSQL databases in details.


(6.0 Marks)

4.b. State the importance of Query Processing and Optimization in


details. (6.0 Marks)

about:blank 4/5
3/25/25, 4:26 PM ESA - Dec 2024 - UE21CS351A (set- 1)

4.c. Discuss the feature os DynamoDB with simple query operation.


(6.0 Marks)

4.d. Explain the features of graph database with sample query.


(7.0 Marks)

about:blank 5/5
PES University, Bengaluru
(Established under Karnataka Act 16 of 2013)

END SEMESTER ASSESSMENT (ESA) - Jan - May 2024

UE21CS351AY - Database Management System

Total Marks : 100.0

1.a. Draw an ER diagram for the given scenario :


Suppose that you are designing a database to record information about reality
shows on TV. Your database needs to record the following information:
For each reality show, its name, genre, basic_info and participants name. Any
reality show has at least two or more participants.
For each producer, the company name, company country. A show is produced
by exactly one producer. And one producer produces exactly one show.
For each television, its name, start year, head office. A television may
broadcasts multiple shows. Each show is broadcasted by exactly one
television.
For each user, his/her username, password, and age. A user may rate multiple
shows, and a show may be rated by multiple users. Each rating has a score of
0 to 10.
(8.0 Marks)

1.b. 1b i) Define database management system


ii) Write the purpose of using Database management system over the File
Processing Systems on four key purposes. (2+4) (6.0 Marks)

1.c. Elucidate three-schema architecture with a neat diagram. Explain different


levels involved in the architecture and what are its advantages. (6.0 Marks)
1.d. Enlist 3 different types of attributes with one example each and its
notation used in the Entity Relationship Diagram (5.0 Marks)

2.a. Discuss three different types of Constraints in Relational Model


(6.0 Marks)
2.b. Consider the following relation schema and state

Note:
acct_id is primary key for account relation
loan_id is primary key for loan relation
Write the relational algebraic queries for the following:
1. Fetch the account id’s of all accounts with the balance of Rs 300 or more. (1M)
2. Find the names of all the customers with loans using join operation. (1M)
3. Find the names of all the customers who have either a bank account or a loan
account in the bank (use set operation) (2M)
4. Find the all the customers who have a bank account without load (use set
operation) ( 2M)
(6.0 Marks)

2.c. Consider the following relation:


Sailors (Sid, Sname, Rating, Age)
Boat (Bid, Bname, Color)
Reserves (Sid,Bid,Day)
Specify the SQL statements for the following:
A: Find the names of sailors who have reserved at least one boat.
B: Find the colors of boats reserved by Lubber.
C: find the names of the sailors who have reserved at least two boats
D: Find the ages of sailors whose name begins with B and ends with H and has at
least four characters (8.0 Marks)
2.d. Describe the steps in a line or two to convert Entity Relationship diagram
into Relational Mapping. (5.0 Marks)

3.a. What is the process to determine whether the given two sets of
Functional dependencies say F and G are equivalent?( 2 Marks)
Consider the relation R(A,B,C,D) having two FD sets FD1={A->B, B->C, A->C}
and FD2={A->B,B->C,A->D}. Determine whether FD1 and FD2 are equivalent in
detailed list of steps (4 Marks) (6.0 Marks)

3.b. Given a relation R( X, Y, Z) and Functional Dependency set FD = { X → Y


and Y → Z }, determine whether the given R is in 3NF? If not convert it into 3
NF. (6.0 Marks)

3.c. Illustrate and explain the first normal form, general definition of second
normal form and general definition of third normal form with an example for each.
(2+3+3). (8.0 Marks)
3.d. i)Given relational schema R( P Q R S T U V) with a set of functional dependency
denoted by
FD = { P->Q, QR->ST, PTU->V }.
Determine Closure of (QR) and (PR) (2M)

ii)Consider the relation R(A, B, C, D, E) having the Functional


dependencies : {A -> BC, C -> B, D -> E, E -> D} . Find the candidate keys. (3M)
(5.0 Marks)

4.a. Differentiate between SQL and NOSQL (4.0 Marks)

4.b. What is a transaction in DBMS? Explain ACID properties of a transaction in a


line or two? Specify why these properties are required (5.0 Marks)

4.c. Give the interpretation of the following Neo4J commands (4M)


1. Match(n:Book {title=“existing title}) set
[Link]=“Gosh”,[Link]=324.00,[Link]=true return n
2. Match(n:Book) where [Link]=“the lives of others” set [Link]=“The lives”
return n
3. Match (n:Book) where [Link]<1000 AND ([Link]="Neel" or [Link] =
"Navathe") return n;
4. Match(n) where id(n)=1 remove [Link] return n
(4.0 Marks)
4.d. Give the SQL commands for the following (6m)
1) Create user by the name ‘john’ and password ‘pesu’
2) To provide all permission to user ‘john’ for the table employee
3) Grant insert privilege to all users on table Department
4) SQL command to start a transaction.
5) To eliminate all privileges from user ‘john’ on the view works_on
6) To persistently save all the operations of a transaction. (6.0 Marks)

4.e. With respect to Concurrency control of database management system


describe the following in a line or two: 6M

2 phase locking protocol


Wait – die deadlock prevention scheme
Wound – wait deadlock prevention scheme
(6.0 Marks)
PES University, Bengaluru
(Established under Karnataka Act 16 of 2013)

END SEMESTER ASSESSMENT (ESA) - Jan - May 2024

UE21CS351A - Database Management System

Total Marks : 100.0

1.a. With respect to ER model define


i. Multivalued attribute
ii. Participation constraint
iii Cardinality Ratio
iv. Recurring Relationships
v. Weak Entity
vi. Composite attribute (6.0 Marks)

1.b. Mention the steps in converting ER Diagram to Relational Schema (6.0 Marks)

1.c. XYZ Hospitals is a large medical facility that provides a wide range of
healthcare services to patients. The hospital's administration wants to implement a
new database system to manage various aspects of its operations, including
patient records, medical staff, appointments, treatments, and billing. The database
will help streamline processes, improve data accuracy, and ensure compliance with
healthcare regulations.
Draw the ER Diagram by identifying entities, relationships, and attributes clearly,
ensuring that all connections reflect the hospital's workflow accurately. (8.0 Marks)
1.d. Describe three schema architecture with neat diagram. (5.0 Marks)

2.a. Write about any two Aggregate functions in SQL with suitable queries.
(4.0 Marks)

2.b.
Given the schema
EMP ( Fname, Lname, SSN, Bdate, Address, Sex, Salary, SuperSSN, Dnumber)
DEP T(Dname, Dnumber, MgrSSN, MGrstartdate)
DEPT-LOC (Dnumber,Dloc)
PROJECT(Pname, Pnumber, Ploc,Dnumber)
WORKS-ON (ESSN,PNo,Hours)
Give the relation algebra expression for the following:
i. List first name, last name of female employees from Dnumber=20 earning less
than 50000
ii. Retrieve the first name, last name and salary of all employees who work in
departmental number 50.
iii. Retrieve the first name, last name of the manager of each department.
iv. Retrieve the name and address of all employees who work for sports
department.
(8.0 Marks)
2.c. Consider the following tables:
Employee (Emp_no, Name, Emp_city)
Company (Emp_no, Company_name, Salary)
i. Write a SQL query to display Employee name and company name. (2M)
ii. Write a SQL query to display employee name, employee city, company name
and salary of all the employees whose salary >10000 (3M)
iii. Write a query to display name all the employees working in ‘XYZ’ company.(3M)
(8.0 Marks)

2.d. What are Triggers and stored procedures in SQL? Explain each with
appropriate examples (5.0 Marks)

3.a. A relation R has four attributes ABCD. For the following sets of Function
Dependency(FD), identify the candidate key and the highest normal form:
i. FD= { C →D,
C→A,
B→C } (4.0 Marks)

3.b. List and explain in two to three lines each of the ACID properties? (5.0 Marks)
3.c. Illustrate and explain the first normal form(1NF), general definition of second
normal form (2NF) and general definition of third normal form(3NF) with an
example for each of them. (8.0 Marks)

3.d. i. Explain the Armstrong’s Inference Rules.(4M)


ii. Check whether the below given schedule S is conflict serializable or not.

(8.0 Marks)

4.a. Describe NoSQL Characteristics related to distributed databases and


distributed systems. (5.0 Marks)
4.b. Explain MongoDB data model [2M] and write the following queries using
MongoDB :
i. Creating collections named "Employee"[2M]
ii. Retrieving those documents from the employee collection where the value of the
salary field is less than 30000.[2M]
iii. Retrieving only those employee’s documents whose name is either RAM or RAJ.
[2M]
iv. Retrieving employees whose Gender is 'male' and 'salary' is 80000.[2M]
(10.0 Marks)

4.c. With respect to Neo4j Data model define with suitable exapmle the :
i. Nodes [2M]
ii. Properties [2M]
iii. Relationships[2M] (6.0 Marks)

4.d. Differentiate between SQL and NoSQL databases. (4.0 Marks)


11/8/24, 12:44 PM ESA - DEC 2023 - Minor - UE21CS351AX (set- 1)

PES University, Bengaluru


(Established under Karnataka Act 16 of 2013)

END SEMESTER ASSESSMENT (ESA) - DEC 2023

UE21CS351A. - Database Management System

Total Marks : 100.0

1.a. Briefly describe the main characteristics of Database Systems.


(6.0 Marks)

1.b. List the three levels of data abstraction. Briefly explain what happens
at each level. (6.0 Marks)

about:blank 1/7
11/8/24, 12:44 PM ESA - DEC 2023 - Minor - UE21CS351AX (set- 1)

1.c. Define what is a foreign key in a relation. What is its purpose?


Consider the following six relations for an order-processing database
application in a company:

CUSTOMER (Cust#, Cname, City)


ORDER (Order#, Odate, Cust#, Ord_Amt)
ORDER_ITEM (Order#, Item#, Qty)
ITEM (Item#, Unit_price)
SHIPMENT (Order#, Warehouse#, Ship_date)
WAREHOUSE (Warehouse#, City)

Here, Ord_Amt refers to total dollar amount of an order;


Odate is the date the order was placed;
Ship_date is the date an order (or part of an order) is shipped from
the warehouse.
Assume that an order can be shipped from several warehouses.
Specify the foreign keys for this schema, stating any assumptions you
make. Draw a relational schema diagram to show these foreign keys.
What other constraints can you think of for this database? (6.0 Marks)

1.d. Consider the following COMPANY database:


1. EMP (Fname, Lname, SSN, Salary, SuperSSN, Gender, Dno)
2. DEPT (Dnum, Dname, MgrSSN, Dno)
3. DEPT_LOC (Dnum, Dlocation)
4. DEPENDENT (ESSN, Dep_name, Sex)
5. WORKS_ON (ESSN, Pno, Hours)
6. PROJECT (Pname, Pnumber, Plocation, Dnum)
Develop an ER diagram for keeping track of information about a company
database including primary keys, composite attributes, weak entities, etc.
(7.0 Marks)

about:blank 2/7
11/8/24, 12:44 PM ESA - DEC 2023 - Minor - UE21CS351AX (set- 1)

2.a. Consider a STUDENT relation in a UNIVERSITY database with the


following attributes:=
(Name, SSN, Local_phone, Address, Fees, Age, GPA).
1. List the five aggregate functions available in ANSI SQL.
2. Apply these SQL functions on the following relation for all students
whose GPA is above 3.0.
A possible tuple of the relation is shown below:
Name SSN LocalPhoneAddress Fees AgeGPA
George 123 Main St.,
123-45-
Bernard 555-1234 Anytown, CA 15432119 3.45
6789
Shaw 94539
.
.
.
etc. (6.0 Marks)

2.b. Differentiate between the following SQL commands/terms. Give


examples for each term.
1. Alter and Update
2. Delete and Drop
3. Right Outer Join and Inner Join
4. Table and View
(4.0 Marks)

2.c. Consider the following relation schema


1. Works (Emp-name, Comp-name, Salary)
2. Lives (Emp-name, Street, City)
3. Located_in (Comp-name, City, Zipcode)
4. Manager (Emp-name, Mgr-name)

Write the SQL queries for the following:


i) Find the names of all employees who live in the city Bangalore.
ii) Retrieve the names of all employees of "ApexSystems" whose salary is
between Rs .50000 and 1 lakh.
iii)Find the names of all employees who lives and work in the same city.
iv)List the names of the employees who work for “TechE” along with the
cities they live in. (8.0 Marks)

about:blank 3/7
11/8/24, 12:44 PM ESA - DEC 2023 - Minor - UE21CS351AX (set- 1)

2.d. Map the BANK ER schema shown in Figure into a relational schema
diagram. Specify all primary keys and foreign keys.
Write a SQL CREATE statement for the entity LOAN.

(7.0 Marks)

3.a. IR1, IR2, IR3 form a sound and complete set of inference rules called
Armstrong's inference rules.
Describe each rule with proper notations and an example each.
(6.0 Marks)

about:blank 4/7
11/8/24, 12:44 PM ESA - DEC 2023 - Minor - UE21CS351AX (set- 1)

3.b. Briefly explain the following terms:=


1. Normalization
2. Normal form
3. Denormalization
What is each of 3NF, 4NF, 5NF based on? (6.0 Marks)

3.c. Why are ACID properties required?


Expand ACID acronym.
Describe each of the ACID properties in 2-3 sentences. (6.0 Marks)

3.d. Enumerate the five transaction states describing each one with 1-2
sentences each.
Draw a state transition diagram of a transaction. (7.0 Marks)

about:blank 5/7
11/8/24, 12:44 PM ESA - DEC 2023 - Minor - UE21CS351AX (set- 1)

4.a. Describe structured, semi-structured and unstructured type of data.


Give examples for each. (6.0 Marks)

4.b. Define CAP theorem.


Explain the three desirable properties. (6.0 Marks)

4.c. Compare SQL and NOSQL databases. (5.0 Marks)

about:blank 6/7
11/8/24, 12:44 PM ESA - DEC 2023 - Minor - UE21CS351AX (set- 1)

4.d. Expand NoSQL.


What are NoSQL databases?
List and then describe the four different types with examples. (8.0 Marks)

about:blank 7/7
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 2)

PES University, Bengaluru


(Established under Karnataka Act 16 of 2013)

END SEMESTER ASSESSMENT (ESA) - DEC 2023

UE21CS351A - Database Management System

Total Marks : 100.0

1.a. Define Data abstraction [2 marks] and Define Data model [1 mark].
Identify the data model for the following figure [1 marks] and discuss
important points with respect to identified data model [4 marks].

Figure:

(8.0 Marks)

about:blank 1/6
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 2)

1.b. What are parallel databases [1 mark] and discuss any two
architectural designs for parallel DBMS with neat diagram [4 marks].
(5.0 Marks)

1.c. You are given the following requirements for a simple database for
the National Hockey League (NHL):
1. the NHL has many teams,
2. each team has a name, a city, a coach, a captain, and a set of players,
3. each player belongs to only one team,
4. each player has a name, a position (such as left wing or goalie), a skill
level
5. a team captain is also a player
6. a game is played between two teams (referred to as host_team and
guest_team) and has a date (such as May 11th, 2019) and a score
(such as 4 -2)
Construct a clean and concise ER diagram for the NHL database. List your
assumptions and clearly indicate the cardinality mappings, participation
constraints in your ER diagram.[6 marks]

Convert the NHL ER diagram to relational mapping and mention the steps
used for conversion clearly. [6 marks] (12.0 Marks)

2.a. Write the following queries as relational algebra expressions.


Author(name, city, age, expert_in)
Book(title, author_name, pages, price)

i) list the author details who are expert in Pattern Recognition and live in
Bengaluru.
ii) list the titles of the books which are written by Stallings and have either
380 pages or cost Rs.450.
iii) display author names, who have authored books on OS and DS as well.
(6.0 Marks)

about:blank 2/6
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 2)

2.b. Consider the given schema

Note: Person_name is primary key of employee


Company_name is primary key of company
Person_name and Company_name is composite primary key
Above tables are already created in database and we need to modify the
schema for following
1. Add the column named emailID to employee table with appropriate
datatype and add appropriate constraint which makes emailID data
mandatory. [1 mark]
2. Remove the Salary column from works table and add it in employee
table. [2 marks]
3. Consider city attribute in company table as multivalued attribute so
Drop the column city from company table and create a separate
table for city which is multivalued attribute and add companyName
as foreign key in city table. And make sure you are adding
appropriate primary key for city table [3 marks]
(6.0 Marks)

2.c. Consider the below employee database, where the primary keys are
underlined. Give an expression in SQL for each of the following queries.

1. Find the names and cities of residence of all employees who work for
First Bank Corporation. [2marks]
2. Find all employees in the database who live in the same cities as the
companies for which they work. [2marks]
3. Find all employees in the database who earn more than every
employee of Small Bank Corporation. For this query, assume that all
people work for at most one company. [2marks]
4. Assume that the companies may be located in several cities. Find all
companies located in every city in which Small Bank Corporation is
located. [2marks]
(8.0 Marks)

about:blank 3/6
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 2)

2.d. What are triggers [1 mark] and write a trigger statement for checking
student age before enrolling to course. If age is less than 18, he should
not be allowed to register to course else add him to registration table. [4
marks]
Following table data can help you in writing trigger:
Student
StudentID Name EmailID Age Phoneno

Course
CID CourseName Credits

Registration
StudentID CID DateOfRegistrationFeesPaid
(5.0 Marks)

3.a. Consider the relation scheme R = {E, F, G, H, I, J, K, L, M, N} and the set


of functional dependencies {{E, F} -> {G}, {F} -> {I, J}, {E, H} -> {K, L}, K ->
{M}, L -> {N} on R. Find the key for R? (5.0 Marks)

3.b. A relation R (A, C , D , E , H) is having two functional dependencies sets


F and G as shown-
Set F:
A→C
AC → D
E → AD
E→H
Set G:
A → CD
E → AH

Find whether F Covers G, G covers F and F is Equivalent to G. (10.0 Marks)

about:blank 4/6
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 2)

3.c. Consider the universal relation R = {A, B, C, D, E, F, G, H, I, J} and the


set of functional dependencies F = {{A, B} →{C}, {A}→{D, E}, {B}→{F}, {F}
→{G, H}, {D}→{I, J}}. Key of the R is AB? Decompose R into 2NF and then
3NF relations.

(5.0 Marks)

3.d. Check whether the given schedule S is conflict serializable or not-

(5.0 Marks)

4.a. Write the proper code for the following [3 marks]


Consider the company database and write the python code for
connecting to company database. use appropriate parameters for
connect function.

Write a python code for inserting below record to company database.


Need to use appropriate python functions to insert and commit the
changes to database. [2 marks]

Employee(“john”, “B”, “smith” , “234532344”,56000, “research”)


(5.0 Marks)

about:blank 5/6
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 2)

4.b. consider student as collection with fields like name, srn, section,
semester, branch, sgpa, cgpa, phoneno, email.

write MongoDB queries for the following:

1. Retrieving only those students whose CGPA is not greater than 8. [1


mark]
2. Retrieving only those students whose branch is ECE or semester is 7.
[2 marks]
3. Retrieving only those students whose gender is not Male and whose
branch is not CSE. [2 marks ]
(5.0 Marks)

4.c. With help of an example explain the importance of query


optimization in the database management systems.

Note: draw the query tree to explain the importance of the optimization.
(10.0 Marks)

4.d. Write the characteristics of NoSql systems related to distributed


databases and distributed systems. (5.0 Marks)

about:blank 6/6
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 1)

PES University, Bengaluru


(Established under Karnataka Act 16 of 2013)

END SEMESTER ASSESSMENT (ESA) - DEC 2023

UE21CS351A - Database Management System

Total Marks : 100.0

1.a. (i) Define Database Management system (2 Marks)


(ii) Write the purpose of using Database systems over file processing
systems based on four key purposes. (4 Marks) (6.0 Marks)

1.b. Many database-system users are not computer trained and hence
developer hide all these complexity from the users through several layers
of data abstraction, in order to simplify the users’ interaction with the
system.
Explain the different levels of data abstraction in a Database system with
a neat diagram and (4 Marks)
Define the logical data independence and the physical data independence
in data abstraction. (2 Marks) (6.0 Marks)

1.c. Consider the CAR relation schema and identify the primary key and
candidate key. (2 Marks)
CAR(State, Reg#, SerialNo, Make, Model, Year)
In general, Explain briefly about differentiating the primary key and the
candidate key of a relational schema? (1 Mark) (3.0 Marks)

about:blank 1/8
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 1)

1.d. Consider the following requirements for a simple database of the


National Hockey League (NHL):
the NHL has many teams,
each team has a name, a city, a coach, a captain, and a set of players,
each player belongs to only one team,
each player has a name, a position (such as left wing or goalie), a skill
level, and a set of injury records,
a team captain is also a player,
a game is played between two teams (referred to as host_team and
guest_team) and has a date (such as August 11th, 2023) and a score
(such as 4 to 2)
(i) Construct a clean and concise ER diagram for the NHL database using
the Chen notation as in your textbook.
List the following and draw the ER diagram step by step.(6 Marks)
1. entities(Strong/weak)
2. attributes associated with each entity and relationship,
3. relationships and its type(binary, ternary or recursive)
4. cardinality mappings (one to one, one to many, many to one or many
to many)
5. participation constraint (Total/Partial) as well as any role indicators in
each relationship among the entities
(ii) Convert the same ER diagram into relational schema and indicate the
primary key and foreign key mapping across the relations (4 Marks)

Note:
Chen notation
Indicate cardinality ratio as 1:1,1: N,N:1 and M:N
Participation constraint as total (double line) and partial participation
(Single line)
(10.0 Marks)

about:blank 2/8
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 1)

2.a. Consider the following relational schema and state.

Write the relational algebra queries for the following questions.


1. Fetch the account IDs of all accounts with a balance of Rs.300 or
more (1 Mark)
2. Find the names of all customers with loans using join operation (1
Mark)
3. Find the names of all customers who have either a bank account or a
loan account in the bank (use set operation) (2 Marks)
4. Find all customers who have a bank account without any loan (use
set operation) (2 Marks)
(6.0 Marks)

2.b.
1. What do you mean by views in SQL? Is the view table contents are
precomputed and stored? Illustrate views with an example (3 Marks)
2. Consider the following tables and write a SQL query to fetch the
customer names and their highest purchased amount of each
customer.(2 Marks)
(5.0 Marks)

about:blank 3/8
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 1)

2.c. Consider the relation: student_course(name, course, grade)


consisting of records of grades obtained by the students in various
courses.
The first image displays students and the grades obtained by them in the
course ‘Physics’ and the second image displays students and the grades
obtained by them in ‘Mathematics’.

Predict the output of the following sql queries (1 Mark each)


(i) SELECT grade FROM student_course WHERE course = 'Physics' UNION
ALL SELECT grade FROM student_course WHERE course = 'Mathematics';
(ii) SELECT distinct grade FROM student_course WHERE course =
'Physics' UNION ALL SELECT distinct grade FROM student_course
WHERE course = 'Mathematics';
(iii) SELECT grade FROM student_course WHERE course =
'Physics' INTERSECT ALL SELECT grade FROM student_course WHERE
course = 'Mathematics';
(iv) SELECT grade FROM student_course WHERE course = 'Physics' EXCEPT
ALL SELECT grade FROM student_course WHERE course = 'Mathematics';
(4.0 Marks)

2.d.
1. Explain the different modes of stored procedure parameters?(2
Marks)
2. Write a procedure ‘displaymarks’ to display the marks of student for a
specific srn(type ‘integer') that is passed to the procedure. Write the
commands to invoke the procedure, pass the parameter and fetch
the result of the procedure from the command line client of mysql? (
4 Marks)
(6.0 Marks)

about:blank 4/8
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 1)

2.e. Create a trigger named as 'CheckMarks' that checks whether the


entered marks is within the range of 0 to 100, whenever an input marks
entry is added to the studentMarks table. Display the message as ' Invalid
marks: Marks must be between 0 and 100' when the input marks range is
violated. (4.0 Marks)

3.a. What is the process to determine whether the given two sets of
Functional dependencies, say F and G are Equivalent? (1 Mark)
Consider the relation R(A,B,C,D) having two FD sets FD1 = {A->B, B->C,A-
>C} and FD2 = {A->B, B->C, A->D}. Determine whether FD1 and FD2 are
Equivalent in detailed list of steps. (4 Marks) (5.0 Marks)

3.b. Give the algorithm to find the minimal cover of a set of functional
dependencies and (2 Marks)
Find the minimal cover of the set of given functional dependencies: {A →
C, AB → C, C → DI, CD → I, EC → AB, EI → C} (4 Marks) (6.0 Marks)

about:blank 5/8
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 1)

3.c. Illustrate and explain the first normal form(1NF), general definition of
second normal form (2NF) and general definition of third normal
form(3NF) with an example for each of them. (2+3+3 Marks) (8.0 Marks)

3.d.
1. Differentiate serial and serializable schedules for a given set of
transactions. Briefly explain with two key points.(2 Marks)
2. Consider the below given schedule and check whether the given
schedule is conflict serializable by listing all the conflicting operations
and drawing the precedence graph.(4 Marks)
(6.0 Marks)

about:blank 6/8
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 1)

4.a. Consider the below mongodb collections for ecommerce


database
Products Collection- Document Structure:
- product_id: Unique identifier for each product.
- name: Name of the product.
- description: Description or details about the product.
- price: Price of the product.
- quantity_available: Number of units available in stock for that product.

Customers Collection- Document Structure:


- customer_id: Unique identifier for each customer.
- name: Name of the customer.
- email: Email address of the customer.
- phone: Phone number of the customer.
- address: Address details of the customer.

Orders Collection- Document Structure:


- order_id: Unique identifier for each order.
- customer_id: References the unique identifier of the customer placing
the order.
- order_date: Date and time of the order.
- order_items: Array of objects containing product IDs and quantities
ordered.
- total_amount: Total cost of the order.

Categories Collection- Document Structure:


- category_id: Unique identifier for each category.
- name: Name of the category.
- description: Description of the category.
- products: Array of product IDs belonging to the category.
- parent_category_id: Identifier for the parent category, if applicable.

Reviews Collection- Document Structure:


- review_id: Unique identifier for each review.
- product_id: References the unique identifier of the product being
reviewed.
- customer_id: References the unique identifier of the customer who
wrote the review.
- rating: Rating given to the product by the customer.
- comment: Additional comments or review content.

Answer the following queries


1. Retrieve the products from the 'Products' collection in the
ecommerce database, filtering for items with an inventory that is
either critically low (below 20) or unusually high (exceedingly above
80), accentuating the extremes of availability? (2 Marks)
2. Retrieve the reviews of the products with a rating equal to either 3 or
5. (2 Marks)
3. Update the price of all the 'Boat' brand headphones-products to 400
rupees. (2 Marks)
about:blank 7/8
11/8/24, 12:44 PM ESA - DEC 2023 - UE21CS351A (set- 1)

4. Remove all the 'Orders' in the ecommerce database for the customer
having the 'customer_id' as 5. (2 Marks)
(8.0 Marks)
4.b. Explain the neo4j data model and (3 Marks)
write the following queries using neo4j-cypher query language
1. create a node with label ‘Book’ and a set of properties such as title:
Database, edition: seven and publisher: pearson (2 Marks)
2. Update the title of the book from ‘Database’ to ‘Database system’ (2
Marks)
3. Remove the node with the label book if the title is ‘Database system’
(1 Mark)
(8.0 Marks)

4.c. Explain the steps to access mysql database from a python application
with a neat diagram. (5.0 Marks)

4.d. Write short notes on demand driven pipeline in query processing of a


database system. (4.0 Marks)

about:blank 8/8

You might also like