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

CSA Assignment Questions(b)

The document outlines assignment questions for a Database Management System course, including tasks related to creating ER diagrams, implementing DDL, populating databases, and writing SQL queries for various scenarios. It covers topics such as banking and order processing databases, normalization, deadlock prevention, and concurrency control. Each question requires students to apply their knowledge of database design and SQL to solve practical problems.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

CSA Assignment Questions(b)

The document outlines assignment questions for a Database Management System course, including tasks related to creating ER diagrams, implementing DDL, populating databases, and writing SQL queries for various scenarios. It covers topics such as banking and order processing databases, normalization, deadlock prevention, and concurrency control. Each question requires students to apply their knowledge of database design and SQL to solve practical problems.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

DEPARTMENT OF COMPUTER APPLICATIONS

Invitation Letter Assignment Questions


Course Title: Database Management System
Course Code: UGCA-1922
Branch/ Semester/Section: BCA/4th/A

S.No. Question Roll No CO Remarks

2311178
A university database contains information about professors
(identified by social security number, or SSN) and courses 2311215
(identified by courseid). Professors teach courses; each of the 2311216
following situations concerns the Teaches relationship set. For
each situation, draw an ER diagram that describes it (assuming no 2311217
1 further constraints hold). 2311218
1. Professors can teach the same course in several semesters, and each 2311219
offering must be recorded.
G1
2. Professors can teach the same course in several semesters, and only
the most recent such offering needs to be recorded. (Assume this
condition applies in all subsequent questions.)

3. Every professor must teach some course.

4. Every professor teaches exactly one course (no more, no less).

5. Every professor teaches exactly one course (no more, no less), and
every course must be taught by some professor.

Consider the following relational schema for a 2311220


2311221
banking database application. Customer (Cid,
2311222
2 Cname); 2311223
2311224 G2
Branch (Bcode, Bname);
2311225
Account (Ano, Atype, Balance, Cid, Bcode);

An account can be a saving account or a current account. Check Atype


in ‘S’ or ‘C’. A customer can have both types of accounts.

1
DEPARTMENT OF COMPUTER APPLICATIONS

Transaction (Tid, Ano, Tttype, Tdate, Tamount);

Ttype can be ‘D’ or ‘W’.

D – Deposit, W – Withdrawal

Primary Key is underlined.

Question (A)

:Develop DDL to implement the above schema specifying an


appropriate data type for each attribute enforcing primary key, check
constraints and foreign key constraints.

Question (B)

Populate the database with a rich data set.

Question (C)
Develop a SQL query to list the details of customers who

have a saving account and a current account. Question (D)

Develop a SQL query to list the details of branches and

the number of accounts in each branch.

Question (E)

Develop a SQL query to list the details of branches where the number
of accounts is less than the average number of accounts in all
branches.

Question (F) Develop a SQL query to list the details of customers who
have performed three transaction on a day. Question (G)

Create a view that will keep track of branch details and the number of
accounts in each branch.

2
DEPARTMENT OF COMPUTER APPLICATIONS

2311226
Question 3
2311227
Consider the following relations for an Order 2311228
3 Processing Database application in a Company. 2311230
Customer (Customerno varchar2 (5), Cname varchar2
2311231
2311233
(50));

Implement check constraints to check Customerno starts with ‘C’.

Cust_Order (Orderno varchar2(5), Odate Date, Customerno G3

references Customer, Ord_amt number(8)); Implement check

constraints to check Orderno starts with ‘O’.

Ord_amt is derived attribute (default value is 0);

Item (Itemno varchar2 (5), Item_name varchar2 (30), unit_price


number (5));

Implement check constraint to check Itemno starts with ‘I’.

Order_item (Orderno references Cust_order,

Itemno references item, qty number (3)); Primary

Key is underlined.

Questions

Question (A)

Develop DDL to implement above schema enforcing primary key,

check constraints and foreign key constraints. Question (B)

Populate Database with rich data set.

Question (C)

3
DEPARTMENT OF COMPUTER APPLICATIONS

Develop SQL query to list the details of

customers who have placed more than 3 orders.

Question (D)

Develop a SQL query to list details of items whose price is less than

the average price of all items in each order. Question (E)

Develop a SQL query to list the orderno and number of items in each
order.

Question (F)

Develop a SQL query to list the details of items

that are present in 25% of the orders. Question

(G)

Develop an update statement to update the value of Ord_amt.

Question (H)

Create a view that keeps track of detail of each customer and number
of Order placed.

4 2311234
2311235 G4
Study and usage of backup and recovery features of Database
Management software. Create queries for how to create and
recover your lost data. 2311237
2311238
2311241
5 2311242 G5
Question 5: Study and usage of Query Optimization Techniques of
Database Management software.

4
DEPARTMENT OF COMPUTER APPLICATIONS

2311244
2311248
2311249
2311253
2311254
6 2311255 G6
. Question 6: The questions are based on the following relational
schema: Emp(eid: integer, ename: string, age: integer, salary: 2311257
real) Works(eid: integer, did: integer, pcttime: integer) Dept(did:
integer, dname: string, budget: real, managerid: integer) 2311258

1. Give an example of a foreign key constraint that involves the Dept


2311259
relation. What are the options for enforcing this constraint when a user 2311261
attempts to delete a Dept tuple?
2311262
2. Write the SQL statements required to create the preceding relations,
including appropriate versions of all primary and foreign key integrity
constraints.

3. Define the Dept relation in SQL so that every department is

guaranteed to have a manager. 4. Write an SQL statement to add

John Doe as an employee with eid = 101, age = 32 and salary =

15, 000. 5. Write an SQL statement to give every employee a 10

percent raise.

6. Write an SQL statement to delete the Toy department. Given the


referential integrity constraints you chose for this schema, explain
what happened when this statement is executed.

7 2311263 G7
Question 1 :Consider the following relations containing airline
flight information: Flights(flno: integer, from: string, to: string, 2311264
distance: integer, departs: time, arrives: time) Aircraft(aid:
integer, aname: string, cruisingrange: integer) Certified(eid: 2311267
integer, aid: integer) Employees(eid: integer, ename: string, 2311268
salary: integer) Note that the Employees relation describes pilots
and other kinds of employees as well; every pilot is certified for 2311269
some aircraft (otherwise, he or she would not qualify as a pilot),

5
DEPARTMENT OF COMPUTER APPLICATIONS

and only pilots are certified to fly. 2311270


Write the following queries in relational algebra, tuple relational
calculus, and domain relational calculus. Note that some of these
queries may not be expressible in relational algebra (and,
therefore, also not expressible in tuple and domain relational
calculus)! For such queries, informally explain why they cannot be
expressed.

1. Find the eids of pilots certified for some Boeing aircraft.

2. Find the names of pilots certified for some Boeing aircraft.

3. Find the aids of all aircraft that can be used on

non-stop flights from Bonn to Madras. 4. Identify the

flights that can be piloted by every pilot whose salary

is more than $100,000.

5. Find the names of pilots who can operate planes with a range greater
than 3,000 miles but are not certified on any Boeing aircraft.

6. Find the eids of employees who make the highest salary.

7. Find the eids of employees who make the second highest salary.

8. Find the eids of employees who are certified for the largest number
of aircraft.
9. Find the eids of employees who are certified for exactly three
aircraft.

10. Find the total amount paid to employees as salaries.

8 2311271 G9
Question 2:Consider the following relations: Student(snum:
integer, sname: string, major: string, level: string, age: integer) 2311275
Class(name: string, meets at: string, room: string, fid: integer)
Enrolled(snum: integer, cname: string) Faculty(fid: integer, 2311277
fname: string, deptid: integer) The meaning of these relations is 2311278
straightforward; for example, Enrolled has one record per
student-class pair such that the student is enrolled in the class. 2311280
2311281

6
DEPARTMENT OF COMPUTER APPLICATIONS

Write the following queries in SQL. No duplicates should be

printed in any of the answers. 1. Find the names of all Juniors

(level = JR) who are enrolled in a class taught by I. Teach. 2. Find

the age of the oldest student who is either a History major or

enrolled in a course taught by I. Teach. 3. Find the names of all

classes that either meet in room R128 or have five or more students

enrolled. 4. Find the names of all students who are enrolled in two

classes that meet at the same time.

5. Find the names of faculty members who teach in every room in


which some class is taught.

6. Find the names of faculty members for whom the combined


enrollment of the courses that they teach is less than five.

7. For each level, print the level and the average age of students for
that level.

8. For all levels except JR, print the level and the average age of
students for that level.

9. For each faculty member that has taught classes only in room R128,
print the faculty member’s name and the total number of classes she or
he has taught.

10. Find the names of students enrolled in the maximum number of


classes.

11. Find the names of students not enrolled in any class.

9 . 2311282 G10

2311285
Question 3:The following relations keep track of airline flight 2311286
information: Flights(flno: integer, from: string, to: string,
distance: integer, departs: time, arrives: time, price: real) 2311287
Aircraft(aid: integer, aname: string, cruisingrange: integer) 2311288

7
DEPARTMENT OF COMPUTER APPLICATIONS

Certified(eid: integer, aid: integer) Employees(eid: integer, ename: 2311289


string, salary: integer) Note that the Employees relation describes
pilots and other kinds of employees as well; every pilot is certified
for some aircraft, and only pilots are certified to fly.
Write each of the following queries in SQL.

1. Find the names of aircraft such that all pilots certified to operate
them have salaries more than $80,000.

2. For each pilot who is certified for more than three aircraft, find the
eid and the maximum cruisingrange of the aircraft for which she or he
is certified.

3. Find the names of pilots whose salary is less than the price of the
cheapest route from Los Angeles to Honolulu.

4. For all aircraft with cruisingrange over 1000 miles, find the name of
the aircraft and the average salary of all pilots certified for this
aircraft.

5. Find the names of pilots certified for some Boeing aircraft.


6. Find the aids of all aircraft that can be used on

routes from Los Angeles to Chicago. 7. Identify

the routes that can be piloted by every pilot who

makes more than $100,000.

8. Print the enames of pilots who can operate planes with cruisingrange
greater than 3000 miles but are not certified on any Boeing aircraft.

9. Compute the difference between the average salary of a pilot and the
average salary of all employees (including pilots).

10. Print the name and salary of every nonpilot whose salary is

more than the average salary for pilots.

10 2311290 G11
Question 4 Consider the following relational schema for a
2311292
banking database application. Customer (Cid, Cname);
2311293

8
DEPARTMENT OF COMPUTER APPLICATIONS

Branch (Bcode, Bname); 2311294


2311295
Account (Ano, Atype, Balance, Cid, Bcode);
2311296
An account can be a saving account or a current account. Check Atype
in ‘S’ or ‘C’. A customer can have both types of accounts.

Transaction (Tid, Ano, Tttype, Tdate, Tamount);

Ttype can be ‘D’ or ‘W’.

D – Deposit, W – Withdrawal

Primary Key is underlined.

Questions

Question (A)

Develop DDL to implement the above schema specifying an


appropriate data type for each attribute enforcing primary key, check
constraints and foreign key constraints.

Question (B)

Populate the database with a rich data set.

Question (C)

Develop a SQL query to list the details of customers who

have a saving account and a current account. Question (D)

Develop a SQL query to list the details of branches and the number of
accounts in each branch.
Question (E)

Develop a SQL query to list the details of branches where the number
of accounts is less than the average number of accounts in all
branches.

9
DEPARTMENT OF COMPUTER APPLICATIONS

Question (F)

Develop a SQL query to list the details of customers who

have performed three transaction on a day. Question (G)

Create a view that will keep track of branch details and

the number of accounts in each branch.

11 2311304 G12

Question 5:Case study on Normalization. 2311306


2311307
2311308
2311309
2311310
12 Question 6 :Explain Deadlock and its prevention in database 2311313 G13
system.
2311316
2311317
2311318
2311320
2311322
13 2311323 G14
Question 7 :Write a short note on concurrency control./ What are 2311330
the problems encountered with concurrent transactions ? Explain
through examples. 2311331
2311301
2311291

10

You might also like