0% found this document useful (0 votes)
87 views13 pages

23bca3co1 Database Management Systems Question Bank 2024 Revised

Uploaded by

moraxyt8129
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views13 pages

23bca3co1 Database Management Systems Question Bank 2024 Revised

Uploaded by

moraxyt8129
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Subject Code: 23BCA3C01 Semester – III

QUESTION BANK

Database Management Systems

Blueprint of DBMS Programming:

Section MODULE 1 MODULE 2 MODULE 3 MODULE 4 MODULE 5


Number of Number of Number of Number of Number of
Questions Questions Questions Questions Questions
A (5
1 1 2 1
marks)
B (9
1 1 1
marks)
C (12
1
marks)

MODULE 1:

SECTION – A
1. 5 Marks Questions
Blooms CO Marks

Level
1. Explain about multi-valued dependencies and Fourth normal form? L2 CO3 5
2. Explain any five roles of database administrator. L2 CO1 5
3. Discuss any five notations used in the E-R model L2 CO1 5
4. Define cardinality. Explain different types of cardinality relationships L2 CO1 5

with examples.
5 Describe the three schema architecture. L2 CO1 5
6. Explain the different views of a database. L2 CO1 5
7. Explain the properties of decomposition. L2 CO1 5
SECTION – B
2. 9 Marks Questions
1. Sketch the ER Diagram for parking management system. Mention your L3 CO1 9
assumption clearly.
2. Sketch an ER diagram for a car insurance company that has a set of L3 CO1 9
customers, each of whom owns one/more cars. Each car has been
associated with zero or any number of recorded accidents.
3. L3 9
Identify key attribute and sketch ER-Diagram for the following Movie
Database

Movie{MID, mname, typeofmovie, duration, budget, year, date}

DIRECTOR{DID,MID,fname,lname,dob, place}

MUSICDIRECTOR{MUID,fname,lname,dob,place}

ACTOR{AID,MID,fname,lname,dob,place}

PRODUCE{PID,MID,fname,lname,place}
3. L2 CO2 9
Describe the database architecture with a neat diagram.
4. i) Discuss any two data models. L2 CO1 4+5

ii) Explain three views of database architecture.


5. Let's assume there is a company where employees work in more than L6 CO3 9
one department.
EMPLOYEE table:
Convert the given table into BCNF.

EMPID EMP Role DEPTN Room no


AME
NAME

1 RAM Professor CIVIL,CS 702

2 SUNIL Associate MECHAN 604


Professor ICAL,IS

3 RAKSHITH Professor CS,IS 302


A

4 SEEMA Assistant AIML 101


Professor

6. Interpret the concept of Normalization (INF, 2NF, 3NF, BCNF )with L3 CO3 9

suitable example.
MODULE 2:

SECTION – A
1. 5 Marks Questions:
Blooms CO Marks

Level

1 Illustrate with example the syntax of group by and having clause in SQL. L3 CO2 5
2 Explain built in functions and aggregate functions in SQL. L2 CO2 5
3 Consider the table Employee with attributes empno, ename, job , L3 CO2 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

i) Write a SQL query to display the empno, ename, job, hiredate, provide
alias for each column, display only employees who are working as
PRESIDENT or ANALYST, and employees belonging to deptno 10 or 20,
and ename should not start with S.
ii) Write a SQL query to display ename, salary, comm, calculate total
salary and annual salary of all employees whose salary ranges from
1000 and 2500, and employees belong to department 10 or 30. And
who is working as SALESMAN.
iii) Write a SQL query to display ename, salary, Deptno to display only
employees who are not working under any manager.
iv) Write a SQL query to display ENAME, SAL, HIRDATE display details of
employees who have been with the company for more than thirty
years, who are not drawing salary from 1500 to 3000.
v) Write a SQL query to display the details of all employees whose name
is Smith. But you are not sure in which case enames are stored. Which
statement will list all the employees whose ename is Smith?
4 Consider the table Employee with attributes empno, ename, job , L3 C O2 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.
) Write a SQL Query to display ename, deptno, salary, comm and find
increment of salary by 10%, and increment of commission by 5% for all
employees and sort salary and department number.
ii) Write a query to hike the salary of the employees below using CASE if
Job is CLERK hike by 15% If job is SALESMAN hike by 10% Or if job is
ANALYST hike by 12%.
5 Consider the table Employee with attributes empno, ename, job , L3 CO2 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

I) Management wants to know the maximum salary of all the employees


for each deptno, and display only if maximum salary greater than 2800,
sort maximum salary in descending order.
ii) Write a SQL Query to display employee name sal, comm, department
name, location and calculate total salary, annual salary for the department
name RESEARCH or OPERATIONS, sort annual salary in ascending order
iii) Write a query to display the list of employees working under which
manager.
iv) Write a SQL query to display ename and salary in dollar and prefix left
white space of salary by special character by * and employees belongs to
deptno 30 and 40 who is working as salesman and clerk.
v) Write a SQL query to find the sum of the salary for each department
name and for each location, display only sum of the salary should not be
equal to 10000.
6 Consider the table Employee with attributes empno, ename, job , L3 CO2 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

i) Write a SQL query to Display empno, ename, deptno and location of


employee KING and salary between 1000$ to 2000$.
ii) Write a SQL query to find average salary for each job,deptno and loc and
display only details if average salary greater than 5000$. (Use natural join).
iii) Write a SQL query to display all matching and non-matching details
from emp and dept.
iv) Write a SQL query to display all matching and non-matching records
from emp as left table and dept table as right.
v) Write a SQL query to display all matching and non-matching records
from emp and dept as right table.
SECTION – B
2. 9 Marks Questions:
1. Consider the table Employee with attributes empno, ename, job , L3 CO2 9
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write the following queries


i) Write a SQL query to find who is taking maximum salary department
wise, and maximum salary in descending order.
ii) Write a SQL query to find the sum of the salary department wise and
job wise, whose sum of the salary should be greater than 10000.
iii) Write a SQL query to select FIRST n records from a table.
iv) Write a SQL query to remove all the employees in SMITH's
department.
v) Write a SQL query to rename the employee name JONES to ANDY.
vi) Write a SQL query to add one new column country of size 10 to the
table dept.

2 Consider the table Employee with attributes empno, ename, job , L3 CO2 9
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write the queries for the following


i) Write a SQL query to delete all employees who were employed less than
20 years and working in the SALES department.
ii) Write a SQL query to update the salary by 10% for an employee who is
making more than the average salary of his department.
iii) Write a SQL query to add one new column project of size 10 to the
table emp
iv)Write a SQ query to modify the size 20 for the project column
v) Write a SQL query to drop the column country.
3 Consider the table Employee with attributes empno, ename, job , L3 CO2 9
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write a query to:


i) Display maximum average salary for deptno.
ii) Find the count of employees working as CLERK in each department.
iii) Find the sum, minimum and maximum salary of the employees working
in each department for job SALESMAN.
iv) Display ENAME, SAL, DEPTNO, display only employees who are not
working under any manager.
v) Display ENAME, SAL, HIRDATE display details of employees who have
been with the company for more than thirty years, who are not drawing
salaries from 1500 to 3000.
vi) Write a SQL query to find the maximum salary job wise where the

maximum salary should be more than 15000.


4 Consider the table Employee with attributes empno, ename, job , L3 CO2 9
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write a query to:


a) Write a SQL query to find the sum, average, minimum and
maximum of the salary for each department name, whose sum of
the salary is more than 10000.
b) Write a SQL query to display dname, maximum salary from
each department name and maximum salary should be less than
5000 and who is working as SALESMAN.
c) Write a SQL query to display employee name, salary,
department name, location and grade whose grades are 1 or 2,
and working in BOSTON.
d) Write a SQL query to count the number of employees working in
each location having grade 5.
e) Write a SQL query to display matching and non-matching

records from employee and department tables.


5 Illustrate with example the logical operators and order by clause in SQL. L2 CO2 9
6 Demonstrate the Aggregate functions, built in functions with examples for L3 CO2 9

each.

MODULE 3:

SECTION – A
1. 5 Marks Questions:
Blooms CO Marks
Level
1. Summarize on the set operators with a relevant example. L2 CO3 5
2 Define Joins. Explain different types of Joins with appropriate examples. L2 CO3 5

3 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write queries for the below statements


a. Remove employees getting salary less than 20000 from the emp table.
b. Increase the salary 10% for employee those who are earning
commission less than 1000.
c. Add two duplicate records in EMP table same as SMITH name. Delete
the duplicate records in EMP table.
d. Change all the employees hiredate to one day ahead.
e. Update MARTIN salary same as SMITH’s salary.
4 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write a queries for the below statements.

a. Add a new record getting less salary than JONES.


b. Remove the least paid employee who is reporting to BLAKE.
c. Increase 10% salary for employee who is making lowest salary in dept
20.
d. Reduce the commission amount from employee salary for each
employee who was joined after ALLEN joined.
5 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write a queries for the below statements.


a. Delete all employees those who employed less than than 15 years.
b. Increase 100$ for an employee who is making more than the average
salary of his department.
c. Write a query to add one new column Address of size 20 to the table
dept.
d. Write a query to modify the size to 60 for the Address column.
e. Write a query to drop the column Address.
6 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write below queries


a. Write a SQL query to display the location from the department table as
short
Eg: NewYork as NY, Dallas DS, Chicago CG, and BOSTON as BT.

b. Write a SQL query to find the sum of salary by grouping according to job
and ndeptno having cross tabulation.
c. Write a SQL query to display all employees who were joined before
SMITH
joined.
d. Write a SQL query to Increase 250$ commission for BLAKE's team.
7 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write queries for the below

a. Write a SQL query to display the list of employees working under which
manager.
b. Write a SQL query to display ename and salary in dollar and employees
belonging to deptno 30 and 40 who are working as salesman and clerk.
c. Write a SQL query to delete the employees where employee salary is
greater
than average salary of the department salary.
d. Write a SQL query to modify the size 20 for the ename column.
8 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write the queries for the following


a. Write a SQL query to display which employee is getting
minimum salary from the deptno 30.
b. Write a SQL query to display employee name, job and their
department name whose job should be similar to JONES job and
deptno similar to empno7934.
c. Write a SQL query to delete all employees who are only
managers.
d. Write a SQL query to find average salary for each job, deptno
and display only details if average salary greater than 5000$. (Use
natural join).
9 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write the queries for the following.


a. write a SQL query to list the employee's name and job
name as a format of
"Employee & Job".
b. Write a SQL query to add a column deptno 50 to the dept table.
Mention the
error if there is any error.
c. Write a SQL query to find those employees with hire date in the
format like
February 22, 1991. Return employee ID, employee name, salary,
hire date.
d. Write a SQL query to count the number of characters except
the spaces for
each employee name. Return employee name length.
10 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write the queries for the following.


a. Write a SQL query to delete the record from the emp table
where the employee should be working as similar to JONES.
b. Write a SQL query to find those employees whose designation is
‘CLERK’ and their
managers. Return complete information about the employees.
c. Write a SQL query to identify those employees who retired
after 31-Dec-99,
completing eight years of service. Return employee name.

d. Write a SQL query to update the location of SALES department


from CHICAGO to
NAPERVILLE.
11 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write the queries for the following


a. Write a SQL query to delete all employees who were employed
less than 15 years and working in the SALES department.
b. Write a SQL query to update the salary by 10% for an employee
who is making more than the average salary of his department.
c. Write a SQLquery to find the average, minimum, and maximum
salaries of the group of employees having the job of ANALYST.
d. Write a SQL query to delete employee details working in SALES
dept.
12 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write the queries for the following


a) Write a SQL query to find the maximum salary job wise where
the maximum salary should be more than 15000.
b) Write a SQL query to display ename, mgr, dname, loc and mgr
value as NOMANAGER if mgr is null .
c) Write a SQL query to find the employees hired in last n months.
d) Write a SQL query to display empno, ename ,sal,loc, dname and
there GRADE of employees working in deptno 10 and loc is
DALLAS. Mention the types of joins used in the query.
e) Write a SQL query to display the top second salary from the
employee table.
f) Write a SQL query to display employees working for the
department name
RESEARCH and located in DALLAS.
13 Consider the table Employee with attributes empno, ename, job , L6 CO3 5
hiredate, salary, Comm. and table Dept with the attributes Deptno,
Deptname, loc.

Write a query to:


a. Display maximum average salary for deptno.
b. Find the count of employees working as CLERK in each
department.
c. Find the sum, minimum and maximum salary of the employees
working in each department for job SALESMAN.
d. Display ENAME, SAL, DEPTNO, display only employees who are
not working under any manager.
e. Display ENAME, SAL, HIRDATE display details of employees who
have been with the company for more than thirty years, who are
not drawing salaries from 1500 to 3000.
f. Write a SQL query to find the maximum salary job wise where
the maximum salary should be more than 15000.

MODULE 4:

SECTION – A
1. 5 Marks Questions
Blooms CO Marks

Level
1 Explain any five constraints with an example. L2 CO4 5
2 Write the queries for the following L6 CO4 5
i. Create a view empvu20 which has all employees details work for the
deptno 20.
ii. Write a SQl query to create a view on emp and dept table which has
details like ename, deptno, sal, dname and loc for deptno 10, and salary
should be between 1000 to 2000 and who are not drawing commission.
iii. Write a SQL query to create view as EMPDETAILS from the tables EMP,
DEPT and SALGRADE which contains empno, ename, job, sal, deptno,
dname,loc and grade, where employees working as ANALYST and are
not belongs to deptno 10 and 20
3 Write the queries below: L6 CO4 5
i. Create a table persons with the fields personid, first name, last
name, address and city.with primary key as personid.
ii. Insert the 5 records to the persons table considering the person
id from 101 to105.
iii. Modify the address field for the personid 101
iv. Alter the table with new field as mobileno
v. Write a SQL query to select the records who lives in Bangalore
city and stays at the address Shanthi Apartments.
4 Illustrate with an example the primary key and Foreign key along L4 CO4 5
with the constraints and syntax.
5 Explain the syntax to create table level constraints and column L2 CO4 5
level constraints with an example.
6 Write a SQL query to create a view on emp and dept table which L6 C04 5
has only details about deptno 20 Like ename, deptno, sal, dname
and loc where salary should be between 10000 to 20000 and who
are not drawing commission.
8 Write a SQL query to the following student_marks table. L6 C04 5
i.Create a table student_marks with stuid as primary
key,studname, marks,studgrade.
ii.Insert 3 records to the student marks table.
iii.create a view studentdata and display the rows with
studname,studgrade whose grades are A+.
iv.Sort the marks details of the studentdata view in ascending
order.
v.Write a query through views to display student data whose
marks lies between 80 to 95.
9. Differentiate between delete, truncate and drop commands L4 CO4 5
through suitable examples.
SECTION – B
2. 9 Marks Questions
1. Explain index and its types with an example. L2 CO4 9
2 Write the queries for the following L6 CO4 9
i. Create table job_history by Copying the structure data from
emp table.
ii. Insert three records to the emp table.
iii. Write a SQL query to display unique records from both table
emp and job_history.
iv. Write a SQL query to Display the employees work for the
company from beginning to till date from both the table emp
and job_history.
v. Write a SQL Query to display employees who joined recently
who have joined since the beginning.
3 i. Write a query to create a table PROGRAMMERS with the following 5 CO4 9
structure.
P_Name 20 Characters

DOJ Date

SAL NUMBER

EMPNO NUMBER

ii. Write a SQL query to set the primary key to the EMPNO column
iii. Write a SQL query to disable the primary key column.
iv. Write a SQL query to drop the primary key from the table.
v. Write a SQL query to drop the table.
vi. Create a view on the table PROGRAMMERS.
4 i. Write a SQL query to create the table called product with attributes L6 CO4 9
pno, pname, pprice, qty and total add the constraint not null for the
required columns and add check constraint to price >0.
ii. Add the constraint primary key to pno by modifying the table.
iii. Insert five records to the product table at run time.
iv. Add a new column special offer.
v. Delete first three records.
vi. Truncate the table product.
5 Describe views and illustrate how views are created with an L4 CO4 9
example by considering the student database with the attributes
as stuid, stuname, stuaddress, stuphone.
6 Write a query for the below statements L6 CO4 9
i. Write the syntax to alter the table to add a new column to
the table.
ii. Write the syntax to alter the table to modify the column from
the table.
iii. Write the syntax to alter table to drop column from table.
iv. Write the syntax to rename the table.
v. Write the syntax to enable the constraint.
7 i. Write a SQL query to create a manufacturer table with L6 CO4 9
manufacturerid, manufacturer_name and contact_address as
columns.
ii. manufacturer_name Should not be null.
iii. Set primary key constraint for manufacturer_id.
iv. Increase the size of the manufacturer_name column.
v. Insert at least three records.
Alter the table manufacturer with phone_number as another
column.

8 Define views? Explain types of views with suitable examples. L2 CO4 9

9 Explain the table level, column level constraints and integrity constraints L2 CO4 9
with suitable examples.
10 Define triggers? Explain types of triggers with suitable examples L2 CO4 9

MODULE 5:

SECTION – C
3. 12 Marks Questions
1 a) i)Write a SQL query to create a role as “developer “with password as L6 CO5 6
"pwd".
ii)write a SQL query to grant a CREATE TABLE privilege to the ROLE
“developer”.
iii) write a SQL query to revoke a CREATE TABLE privilege from
“developer” ROLE and write a query to drop a role called developer.
b) Write a SQL transaction that performs the following operations:
deducts a certain amount from a customer’s account balance in one
table and adds the same amount to another customer’s account L6 6
balance in a different table. Ensure that the transaction adheres to the
ACID properties and includes error handling.
2 a) Differentiate between conflict-serializability and view- L3 CO5 6
serializability. Provide examples to illustrate both concepts.
b) Given a schedule of transactions, explain how you would
determine if it is conflict-serializable. Illustrate your explanation L3 6
with an example schedule and its corresponding serialization
graph.
3 a) Discuss the concept of Serializable Schedules in the context of database L6 CO5 6
transactions. How does serializability ensure that the outcome of
concurrent transactions is equivalent to some serial execution of those
transactions?
b) Describe ACID properties in RDBMS.
L3 6
4 a) Illustrate with example Granting permissions, revoke permissions and L6 CO5 6
create user and their privileges in RDBMS.
b) Explain the importance of using ROLLBACK in a transaction and provide
an example scenario where ROLLBACK would be necessary to maintain
data integrity.
L2 6
5 a) Write SQL commands to create a new database user named L6 CO5 6
"report_user" and grant them the ability to select data from all tables in
the "Sales" schema but not modify any data.
b) Later, the role of "report_user" changes, and they now need permission
to insert data into a specific table within the "Sales" schema. Provide the
SQL command to grant this new permission and discuss the importance of L6 6
adjusting user permissions as roles evolve.
6 a)Define serializability in the context of transaction management in L6 CO5 6
RDBMS. Explain why it is important for maintaining database consistency.
b) Illustrate with examples the triggers and creating trigger for an
application of your choice. L6 6

You might also like