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

DBMS UNIT-2 Assignment Questions R23

The document contains assignment questions related to Database Management Systems (DBMS), focusing on SQL queries, relational schemas, integrity constraints, and various operations in SQL. It includes specific tasks such as writing SQL queries for given relational schemas and defining key terms related to databases. Additionally, it provides previous questions for practice on similar topics.

Uploaded by

csewarriors2k23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

DBMS UNIT-2 Assignment Questions R23

The document contains assignment questions related to Database Management Systems (DBMS), focusing on SQL queries, relational schemas, integrity constraints, and various operations in SQL. It includes specific tasks such as writing SQL queries for given relational schemas and defining key terms related to databases. Additionally, it provides previous questions for practice on similar topics.

Uploaded by

csewarriors2k23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DBMS UNIT-2 (R23)

Assignment Questions
1) How the select and project will be impact on sql querying database with examples.
2) a) What are NULL values? How do they effect the meaning of the queries. Can foreign
key values in database be NULL or duplicates? Justify your answer.
b) Consider the following relational Schema:
Sailors(sid:Integer, sname: String, age: Integer, rating: Integer)
Boats(bid: Integer, bname: String, bcolor: String)
Reserves(sid: Integer, bid: Integer, date: Date)
Write the following queries in SQL:
i) Find names of Sailors who have reserved red and green boat
ii) Find the names of Sailors who have reserved all boats.
3) a) Define the following terms: relation schema, relational database schema, domain,
attribute, attribute domain, relation instance, and relation cardinality.
b) When are integrity constraints enforced by a DBMS? What is referential integrity?
Explain with examples.
4) a) What are integrity constraints? Define the terms primary key constraint and foreign
key constraint. Give Examples.
b) Explain with examples, different DDL and DML operations in SQL.

Previous questions to practice queries

1) a) What is a foreign key constraint? Why are such constraints important? What is
referential integrity? [July-22]
b) Define the following terms with examples: relation schema, relational database schema,
domain, and relation degree. [July-22]

2) a) What are Dr. E.F. Codd Laws for fully functional relational database management
systems? Explain. [Feb-23]
b) Consider the following Relational Schemas:
Sailors(sid:integer, sname:string, age:integer, rating:integer)
Boats(bid:integer, bname:string, bcolor: string)
Reserves(sid: Integer, bid: Integer,date:Date)
Write the following queries in SQL:
i) Find names of Sailors with third highest rating
ii) Find the age of youngest sailor who is eligibile to vote(18 years age) for each rating
level with atleast 2 sailors. [Feb-23]

3) Consider the following relations:


Student(snum: integer, sname: string, major: string, level: string, age: integer)
Class(name: string, meets at: string, room: string, fid: integer)
Enrolled(snum: integer, cname: string)
Faculty(fid: integer, fname: string, deptid: integer)
Write the following queries in SQL:
a) Find the names of all Juniors (level = JR) who are enrolled in a class taught by Prof. Krishna.
b) Find the age of the oldest student who is either a History major or enrolled in a course taught
by Prof. Joseph.
c) Find the names of all classes that either meet in room R128 or have five or more students
enrolled.
d) Find the names of all students who are enrolled in two classes that meet at the same time.
e) Find the names of faculty members who teach in every room in which some class is taught.
f) Find the names of faculty members for whom the combined enrollment of the courses that they
teach is less than five.
g) For each level, print the level and the average age of students for that level.[July-22]

4) Consider the following relational schema. An employee can work in more than one
department; the pct time field of the Works relation shows the percentage of time that a given
employee works in a given department.
Emp(eid: integer, ename: string, age: integer, salary: real)
Works(eid: integer, did: integer, pct time: integer)
Dept(did: integer, dname: string, budget: real, managerid: integer)
Write the following queries in SQL:
a) Print the names and ages of each employee who works in both the Hardware department and
the Software department.
b) For each department with more than 20 full-time-equivalent employees (i.e., where the part-
time and full-time employees add up to at least that many full-time employees), print the did
together with the number of employees that work in that department.
c) Print the name of each employee whose salary exceeds the budget of all of the departments
that he or she works in.
d) Find the managerids of managers who manage only departments with budgets greater than $1
million.
e) Find the enames of managers who manage the departments with the largest budgets.
f) If a manager manages more than one department, he or she controls the sum of all the budgets
for those departments. Find the managerids of managers who control more than $5 million.
[July-22]

5) The following relations keep track of airline flight information:


Flights(flno: integer, from: string, to: string, distance: integer, departs: time, arrives: time, price:
real)
Aircraft(aid: integer, aname: string, cruisingrange: integer)
Certified(eid: integer, aid: integer)
Employees(eid: integer, ename: 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.
a) Find the names of aircraft such that all pilots certified to operate them have salaries more than
$80,000.
b) For each pilot who is certified for more than three aircraft, find the eid and the maximum
cruising range of the aircraft for which she or he is certified.
c) Find the names of pilots whose salary is less than the price of the cheapest route from Los
Angeles to Honolulu.
d) For all aircraft with cruising range over 1000 miles, find the name of the aircraft and the
average salary of all pilots certified for this aircraft.
e) Find the names of pilots certified for some Boeing aircraft.
f) Find the aids of all aircraft that can be used on routes from Los Angeles to Chicago.
g) Identify the routes that can be piloted by every pilot who makes more than $100,000. [July-
22]

6) Consider the following schema:


Suppliers(sid: integer, sname: string, address: string)
Parts(pid: integer, pname: string, color: string)
Catalog(sid: integer, pid: integer, cost: real)
The Catalog relation lists the prices charged for parts by Suppliers. Write the following queries
in SQL:
a) Find the pnames of parts for which there is some supplier.
b) Find the snames of suppliers who supply every part.
c) Find the snames of suppliers who supply every red part.
d) Find the pnames of parts supplied by Acme Widget Suppliers and no one else.
e) Find the sids of suppliers who charge more for some part than the average
cost ofthat part (averaged over all the suppliers who supply that part).
f) For each part, find the sname of the supplier who charges the most for that part.
g) Find the sids of suppliers who supply only red parts. [July-22]

You might also like