0% found this document useful (0 votes)
67 views

U23CS404-DBMS and U23OCS02-DBT-Question Bank

U23CS404-DBMS and U23OCS02-DBT-Question Bank

Uploaded by

ELAVARASAN
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)
67 views

U23CS404-DBMS and U23OCS02-DBT-Question Bank

U23CS404-DBMS and U23OCS02-DBT-Question Bank

Uploaded by

ELAVARASAN
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

Question Bank

Course Code and Name: U23CS404 / Database Management Systems


U23OCS02/ Database Technologies
Programme : B.E CSE, CSBS, CCE, CSE(AI&ML), ECE, EEE
B. Tech – AI & DS, IT
Year / Semester: II / III

Academic Year: 2024 – 2025 (ODD)

MODULE I INTRODUCTION TO DATABASES


Part-A (12 Questions)
Bloom's
S. No Question Taxonomy Cognizance Level
Level
Compare DBMS and traditional file processing systems.

1. BT-2 Understand

Label the 3-schema architecture of DBMS.

2. BT-1 Remember

Show the importance of data abstraction in DBMS.


3. Data Abstraction is a process of hiding unwanted or irrelevant BT-1 Remember
details from the end user. It provides a different view and helps

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 1


in achieving data independence which is used to enhance the
security of data.
Write the roles and responsibilities of DBA.
• Database design
• Performance issues
4. • Database accessibility BT-1 Remember
• Capacity issues
• Data replication
• Table Maintenance
What do you mean by Instance and Schema?
Schema refers to the overall description of any given database.
5. BT-1 Remember
Instance basically refers to a collection of data and information
that the database stores at any particular moment.
Define: simple & composite attribute.
• Simple attribute − Simple attributes are atomic values,
which cannot be divided further. For example, a student's phone
6. number is an atomic value of 10 digits. BT-2 Understand
• Composite attribute − Composite attributes are made of
more than one simple attribute. For example, a student's
complete name may have first_name and last_name.
What are views of data?
7. The three levels present in this architecture are Physical level, BT-2 Understand
Conceptual level and External level.
List the different types of data models in DBMS.
• Hierarchical Model
8. • Network Model BT-1 Remember
• Entity-Relationship Model
• Relational Model
• Object-Oriented Data Model
Show the concept of a weak entity set along with suitable
examples.
The entity sets which do not have sufficient attributes to form a
primary key are known as weak entity sets
9. Eg: A company may store the information of dependents BT-1 Remember
(Parents, Children, Spouse) of an Employee. But the dependents
don’t have existence without the employee. So Dependent will
be weak entity type and Employee will be Identifying Entity type
for Dependent.
How are multi-valued and composite attributes represented in
10. BT-1 Remember
RDBMS?

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 2


composite attributes

multi-valued

How to make the weak entity set into a strong one?


A weak entity can be easily converted to a strong entity
11. BT-1 Remember
by adding a primary key or key attribute, which can define
the uniqueness constraint.
How is logical data independence different from physical data
independence?
Logical data independence is concerned mainly with the
12. changing definition of the data in a system or its structure as a BT-1 Remember
whole, where as Physical data independence is concerned
mainly with how a set of data/ info gets stored in a given
system.
Why do we need the Data models? Justify.
• describes the design of the database
• It defines the data elements and the relationships
13. BT-2 Understand
between the data elements
reflect entities, attributes, relationships among data, constraints
etc
Compare and contrast super key with candidate key.
S.NO Super Key Candidate Key

1. It is a set of attributes or It is a set of attributes


columns that uniquely that recognizes the
identifies each row in a tuples in relation or
table. table.
14. BT-2 Understand
2. The count of super keys The count of
is more as compared to candidate keys is less
the candidate key. compared to the
super keys.

3. Every super key cannot All candidate keys


be a candidate key. are super keys.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 3


4. Numerous candidate Numerous super keys
keys collectively make collectively make the
the guidelines to choose guidelines to choose
the primary keys. the candidate keys.

5. The attributes of the The attributes of the


super key can have candidate can also
NULL values. have NULL values.
Define Foreign key with example.
Foreign keys link data in one table to the data in another table.
A foreign key column in a table points to a column with unique
values in another table (often the primary key column) to create
a way of cross-referencing the two tables.
15. BT-2 Understand
CREATE TABLE orders (
order _no INT PRIMARY KEY,
user_id INT REFERENCES users(user_id),
product_sku INT REFERENCES books(product_sku),
);
List the different types of relational algebra operations.

16. BT-1 Remember

Design an E-R diagram for keeping track of the exploits of your


favourite sports team. You should store the matches played, the
scores in each match, the players in each match and individual
player statistics for each match. Summary statistics should be
modeled as derived attributes.

17. BT-3 Apply

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 4


Differentiate between two-tier and three-tier architectures.
Which is better suited for Web applications?

18. BT-2 Understand

List the types of Join operations available in relational algebra.


The different types of join operation are as follows −

• Theta join

• Natural join
19. Outer join − It is further classified into following types − BT-1 Remember

• Left outer join.

• Right outer join.

• Full outer join.


Compare and contrast the inner join and outer join operations
with examples.

20. BT-2 Understand

Why is the fourth normal more desirable than BCNF?


4NF is more desirable than BCNF because it reduces
information repetition. If we consider a BCNF schema not in
21. BT-2 Understand
4NF, we observe that decomposition into 4NF does not lose
information provided that a lossless join decomposition is used,
yet redundancy is reduced.
22. Write about transitive functional dependency. BT-2 Understand

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 5


Whenever some indirect relationship happens to cause
functional dependency (FC), it is known as Transitive
Dependency. Thus, if A -> B and B -> C are true, then A -> C
happens to be a transitive dependency.
Distinguish between lossy and lossless decomposition.

23. BT-2 Understand

Give an example for multi valued dependency.


• Multivalued dependency occurs when two attributes in a
table are independent of each other but, both depend on
24. a third attribute. BT-2 Understand
• A multivalued dependency consists of at least two
attributes that are dependent on a third attribute that's
why it always requires at least three attributes.
Write the need for normalization.
Normalization is a technique for organizing data in a database. It
is important that a database is normalized to minimize
25. BT-2 Understand
redundancy (duplicate data) and to ensure only related data is
stored in each table. It also prevents any issues stemming from
database modifications such as insertions, deletions, and updates.
State the anomalies of 1NF.
Data anomalies are divided into three general categories:
insertion, deletion, and update anomalies. They are named
26. BT-2 Understand
respectively after the relational operations of Insert, Delete, and
Update because it is during the application of these operations
that a relation may experience anomalies.
Let R is a relation schema and X, Y ⊆ R. "If Y ⊆ X, then X →
27. BT-3 Apply
Y" represents which inference rule? Justify.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 6


Suppose you are given a relation R=(A,B,C,D,E) with the
following functional de-pendencies:
BD → E,
A→C
Show that the decomposition into R1=(A,B,C) and R2=(D,E)
is lossy.

Find a single dependency from a single attribute X to another


attribute Y such that when you add the dependency
X → Y to the above dependencies, the decomposition in part
a is no longer lossy.
28. BT-2 Understand
If we were to decompose the relations into:

Tuples 2 and 3 are not in the original relation. Hence, this


decomposition is lossy.b. This decomposition cannot be made
lossless.
The problem is there is no longer a way to make sure
BD → E holds across two relations since they do not share any
attributes. However, a lossy decomposition of the form (A,B,C),
(C,D,E) can be made lossless by adding an FD B → C.

29. List the properties of decomposition. BT-2 Understand


Given a relation R( P, Q, R, S, T) and Functional Dependency
set FD = { PQ → R, S → T }, determine whether the given R is
in 2NF? If not convert it into 2 NF.
Let us calculate the closure of PQS

PQS + = PQSRT
30. BT-2 Understand
Since the closure of PQS contains all the attributes of R,
hence PQS is Candidate Key.
there will be only one candidate key PQS

Definition of 2NF: No non-prime attribute should be partially


dependent on Candidate Key.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 7


Since R has 5 attributes: - P, Q, R, S, T and Candidate Key is
PQS, Therefore, prime attributes (part of candidate key) are P,
Q, and S while a non-prime attribute is R and T
a) FD: PQ → R does not satisfy the definition of 2NF, that
non-prime attribute( R) is partially dependent on part of
candidate key PQS.
b) FD: S → T does not satisfy the definition of 2NF, as a non-
prime attribute(T) is partially dependent on candidate key PQS
(i.e., key should not be broken at any cost).
Hence, FD PQ → R and S → T, the above table R( P, Q, R,
S, T) is not in 2NF
Convert the table R( P, Q, R, S, T) in 2NF:
Since due to FD: PQ → R and S → T, our table was not in
2NF, let's decompose the table
R1(P, Q, R) (Now in table R1 FD: PQ → R is Full F D, hence
R1 is in 2NF)
R2( S, T) (Now in table R2 FD: S → T is Full F D, hence R2 is
in 2NF)
And create one table for the key, since the key is PQS.
R3(P, Q, S)
Finally, the decomposed tables which is in 2NF are:
a) R1( P, Q, R)
b) R2(S, T)
c) R3(P, Q, S)

Part-B (8 Questions)
Bloom's
S.No Question Taxonomy Cognizance Level
Level
Discuss the main characteristics of the database approach and
1. how it differs from traditional file systems. BT-2 Understand

a. What are the three levels of abstraction in DBMS


2. b. Describe the three-schema architecture. Why do we BT-2 Understand
need mappings between schema levels?
Illustrate database system architecture with a neat diagram and
3. BT-2 Understand
explain the various functions.
branch(branch name, branch city, assets)
customer (customer name, customer street, customer city)
loan (loan number, branch name, amount)
borrower (customer name, loan number)
4. account (account number, branch name, balance) BT-3 Apply
depositor (customer name, account number)
Consider the bank database. Give an expression in the relational
algebra for each of the following queries:
i) Find all loan numbers with a loan value greater than $10,000.
SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 8
ploan_number (δamount > 10000 (loan))
ii) Find the names of all depositors who have an account with a
value greater than $6,000.
pcustomer_name (δbalance > 6000 (depositor ⋈ account ))
iii) Find the names of all depositors who have an account with a
value greater than $6,000 at the “Uptown” branch
p customer_name (δ (branch_name = “Uptown” ) (depositor ⋈ account ) )
iv) What are the appropriate primary keys?
The appropriate primary keys are
branchname,loannumber,accountnumber.

5. Describe the types of DBMS architecture with a neat sketch. BT-2 Understand

6. Discuss about different types of Data models? BT-1 Remember


Design an E-R diagram for keeping track of the exploits of your
favorite sports team. You should store the matches played, the
7. scores in each match, the players in each match and individual BT-3 Apply
player statistics for each match. Summary statistics should be
modeled as derived attributes.
Draw E-R diagram for the “Restaurant Menu Ordering System”,
which will facilitate the ordering of food items ordering and
services within a restaurant. The entire restaurant scenario is
detailed as follows. The customer is able to view the food items
menu, call the waiter, place orders and obtain the final bill
through the computer kept in their table. The Waiters through
their wireless tablet PC are able to initialize a table for customers,
control the table functions to assist customers, orders, send Apply
8. BT-3
orders to food preparation staff (chef) and finalize the customer’s
bill. The Food preparation staff (chefs), with their touch-display
interfaces to the system, are able to let the waiter know the status
of each item, and can send notifications when items are
completed. The system should have full accountability and
logging facilities, and should support Supervisor actions to
account for exceptional circumstances, such as a meal being
refunded or walked out on.
Consider the universal relation R={ A,B,C,D,E,F,G,H,I} and
the set of functional dependencies
9. F={(A,B)->{C],{A}->{D,E},{B}->{F},{F}->{G,H}, BT-3 Apply
{D}->[I,J}.what is the key for Decompose R into 2NF,the 3NF
relations.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 9


State the need for normalization of a database and explain the Understand
10. BT-2
various Normal Forms with suitable examples.
Consider a schema R (A, B, C, D) and functional dependencies
A -> B and C -> D. Solve and find whether the decomposition of Apply
11. BT-3
R into R1 (A, B) and R2(C, D) belongs to which one or both
(dependency preserving and lossless join)?
Discuss Join Dependencies and Fifth Normal Form, and explain Understand
12. BT-2
why 5NF?

MODULE II SQL & PL/SQL


Part-A (12 Questions)
Bloom's
S. No Question Taxonom Cognizance Level
y Level
State the integrity constraints of a database table.
Integrity constraints in DBMS are used to ensure that data is
1. BT-2 Understand
consistent and accurate. There are four main types of integrity
constraints: domain, entity, referential, and key.
Mention any three commands under DDL, DML, DCL, and
2. BT-2 Understand
TCL.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 10


Differentiate between having and where clause in MySQL.
WHERE statement is used to filter rows but HAVING statement
3. is used to filter groups. BT-2 Understand
GROUP BY is not used with WHERE. HAVING clause is used
with GROUP BY.
Consider a following relation
P (eno, name, dob, sex, doj, basic pay, dept).
4. Write a SQL query that will find and display the average basic BT-3 Apply
pay in each dept.
select dept,avg (basicpay) from p group by dept
Write a SQL query to find the avg (marks) of students grouped
by departments.
SELECT ROLL_NO,AVG(MARKS) AS "AVERAGE
5. BT-3 Apply
MARKS"
FROM STUDENT GROUP BY ROLL_NO;

Differentiate key attribute and super key.


Key attribute : The attribute or combination of attributes that
uniquely identifies a row or record in a relation is known as
primary key.
6. BT-2 Understand
A superkey is a combination of attributes that can be uniquely
used to identify a database record. A table might have many
superkeys. Candidate keys are a special subset of superkeys that
do not have any extraneous information in them.
Write an example SQL query to illustrate the use of Group By
and Having Clause.
SELECT COUNT(Id), Country
7. BT-2 Understand
FROM Customer
GROUP BY Country
HAVING COUNT(Id) > 10
Write a SQL query retrieves the maximum salary for each
8. BT-3 Apply
department from the “employees” table.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 11


SELECT department, MAX(salary) as max_salary
FROM employees
GROUP BY department;
What is the purpose of the GROUP BY clause in MySQL?
The GROUP BY clause in MySQL is used to aggregate rows that
9. BT-2 Understand
have the same values into summary rows, typically for
performing calculations on grouped data.
Write an SQL query to retrieve distinct values from the
10. "department" column of the "employees" table. BT-3 Apply
SELECT DISTINCT department FROM employees;
Find the monthly salary of employees from the table where the
annual salary is given.

11. BT-3 Apply


SELECT emp_name, (emp_An_salary/12) AS 'Monthly
Salary' ,
emp_An_Salary AS 'Annual Salary' FROM
Employee_salary ;

Write the DDL command for creating the following relational


schema (use the foreign key relationship).
a. employee (eid, ename, place, salary, deptid)
b. department (deptid, dname, no_of_employees)
CREATE TABLE department ( deptid INT PRIMARY
KEY, dname VARCHAR(100) NOT NULL,
12. BT-3 Apply
no_of_employees INT );

CREATE TABLE employee ( eid INT PRIMARY KEY,


ename VARCHAR(100) NOT NULL, place VARCHAR(100),
salary DECIMAL(10, 2), deptid INT, FOREIGN KEY
(deptid) REFERENCES department(deptid) );
Give examples for adding, deleting, changing the columns using
the alter command.
To ADD 2 columns AGE and COURSE to table Student.
ALTER TABLE Student ADD (AGE number(3),COURSE
varchar(40));
13. BT-2 Understand
MODIFY column COURSE in table Student
ALTER TABLE Student MODIFY COURSE varchar(20);
DROP column COURSE in table Student.
ALTER TABLE Student DROP COLUMN COURSE;

Write SQL queries using where clause with BETWEEN, IN


operator.
14. BT-3 Apply
SELECT CompanyName
FROM Supplier

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 12


WHERE Country IN ('USA', 'UK', 'Japan')

SELECT ProductName
FROM Product
WHERE UnitPrice BETWEEN 10
AND 20
ORDER BY UnitPrice
Mention the various aggregate functions in SQL.
Aggregate functions used to combine the result of a group into a
single such as COUNT, MAX, MIN, AVG, SUM.
• SUM(): Returns the sum or total of each group. Understand
15. BT-2
• COUNT(): Returns the number of rows of each group.
• AVG(): Returns the average and mean of each group.
• MIN(): Returns the minimum value of each group.
• MAX(): Returns the minimum value of each group.
How is DML different from DDL?

16. BT-2 Understand

Mention the commands involved in Data Manipulation


Languages.
List of DML commands:
17. BT-2 Understand
INSERT : It is used to insert data into a table.
UPDATE: It is used to update existing data within a table.
DELETE : It is used to delete records from a database table.
LOCK: Table control concurrency.
Write the recursive CTE to find paths of all the node in the given
table “bst”.
18. BT-3 Apply
Input :

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 13


Output:

Answer:
WITH RECURSIVE
cte ( node, path )
AS
( SELECT node, cast ( 1 as char(30) )
FROM bst WHERE parent IS NULL
UNION ALL
SELECT bst.node, CONCAT ( cte.path, '-->', bst.node )
FROM cte JOIN bst ON cte.node = bst.parent
)
SELECT * FROM cte ORDER BY node;

Write a SQL query for the number of employees according to


19. BT-3 Apply
gender whose DOB is between a given range:

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 14


SELECT Gender,count(Gender) FROM department
WHERE DateOfBirth between '1995-01-01' and '1996-12-31'
GROUP BY gender;

Write a SQL query who were born on 2 given dates (Nov 1,2017
& Dec 31, 2017).

20. BT-2 Understand

select Name,DateOfBirth,Date(DateOfBirth) as DatePart


From Employees
Where Date(DateOfBirth) between ‘2017-11-01’ and ‘2017-
10-31’.

Part-B (8 Questions)
Blooms
S.No Question Taxonomy Cognizance Level
Level
Create a table for the data provided and input the values for the
1. table as shown below, and answer the given questions with BT-3 Apply
relevant queries.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 15


1. You are analyzing sales data and need to find the total
revenue generated in 2022 for each product category.
Write the SQL query to find this.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 16


2. You want to analyze employee data to find the
department with the highest average salary. How would
you write the query for this?
3. You want to find customers who have made more than 2
purchases in the last month. How would you write this
query?
4. You want to analyze sales data to find the top 3 products
by revenue in each category. What is the query for this?
A music store is developing a database to manage its inventory
of music albums, artists, and customer orders. Using DDL and
DML commands, create the necessary tables and structures to
manage this data.
Questions:
i. Design the database structure for storing music album
information, including album ID, album title, artist ID,
genre, release date, and price.
2. BT-3 Apply
ii. Create a table to manage artist information, including
artist ID, artist name, country, and record label.
iii. Design a table structure for storing customer order
information, including order ID, customer ID, order
date, shipping address, and order status.
iv. Demonstrate how DML commands can be used to add
new albums, manage artist information, process
customer orders, and update inventory levels.
3. Explain aggregate functions in SQL with example. BT-2 Understand
Consider the following relational schema
Employee ( empno, name, office, age)
Books ( isbn, title, authors, publisher)
Loan ( empno, isbn, date)
Write the following queries using SQL.
i. Find the names of employees who have borrowed a book
4. published by McGraw – Hill. BT-3 Apply

ii. Find the names of employees who have borrowed all books
published by McGraw – Hill.
iii. Find the names of employees who have borrowed more than
five different books published by McGraw-Hill?
iv. For each publisher, find the names of employees who have
borrowed?

5. Consider the following relation:

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 17


Patient-account

Are the following queries valid? If not, specify the reason.


i) INSERT INTO patient-account VALUES (5543, 783, ’TR’,
774, ’T453’).
ii) DELETE FROM patient-account WHERE department=TT.
iii) DELETE FROM patient-account WHERE accounts=1734.
iv) UPDATE patient-account SET amount=600 WHERE
account=4329.
v) Alter table Patient_account add constraint check
amount>600.

Consider a student registration database comprising the


below given table schema.
Student: Student number, student name, Address,
telephone
Course: course no, description, hours, professor number.
Professor: professor number, name, office.
Registration: student number, course number,
date.
Consider a suitable example of tuple/ records for the above-
mentioned tables and write a DML statement to answer for
6. BT-3 Apply
the queries listed below.
(i)Which courses does a specific professor teach?
(ii) What courses are taught by two specific professors?
(iii) Who teaches a specific course and where is his\her
office?
(iv) For the specific student number, in which courses is the
student registered and what is his\her name?
(v) Who are the professors for specific students?
(vi) Who are the students registered in a specific course?

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 18


Consider the following relations for a company
Database Application:
Employee (Eno, Name, Sex, Dob, Doj, Designation,
Basic_Pay, Deptno)
Department (Dept_no, Name)
Project (Proj_no, Name, Dept_no)
Worksfor (Eno, Proj_no, Date, Hours)
The attributes specified for each relation is self-explanatory.
However, the business rules are stated as follows. A department
can control any number of projects. But only one department
can control a project. An employee can work on any number of
7. projects on a day. However, an employee cannot work more BT-3 Apply
than once on a project he she worked on that day. The primary
keys are underlined.
(i) Identify the foreign keys. Develop DDL to implement
the above schema.
(ii) Develop an SQL query to list the department number
and the number of employees in each department.
(iii) Develop a view that will keep track of the department
number, the number of employees in the department, and the
total basis pay expenditure for each department.
iv) Develop an SQL query to list the details of employees who
have marked in more than three projects on a day.

Consider the Employee table and write the SQL queries:

i. Write a query to retrieve empno,ename,job,salary


from employee table of first three records and sort employee
name in ascending order. (Use WITH clause)
ii. Write a query to retrieve empno, ename of each job
8. from the employee table. BT-3 Apply
iii. Write a query to retrieve empno, ename based on the
hiredate from the employee table.
iv. Write a query to display the total number of
employees in each department.
v. Write a query to add the new column Salary
Description and add the contents using CASE function.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 19


Condition: a) If the salary lesser than 10000, then the Hike
will be provided in the next quarter.
b)If the salary is between 20000 and 50000, then the Hike will
be provided in the next year.
c) If the salary is greater than 70000, then the Hike is not
applicable.
vi. Replace the NULL values in the department with
‘N/A’ using COALESCE function.
vii. Write a query to display the average salary in each
department.

SECE-U23CS404 DBMS & U23OCS02 DBT QUESTION BANK Page 20

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