Introduction to Database Systems - - Unit 8 - Week 5
Introduction to Database Systems - - Unit 8 - Week 5
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
Click to register
for Certification
exam
Week 5 : Assignmnet 5
(https://examform.nptel.ac.in/2025_01/exam_form/dashboard)
Your last recorded submission was on 2025-02-26, 09:14 Due date: 2025-02-26, 23:59 IST.
IST
If already
Use the following schema of the academic institution relational database in the following
registered, click
questions wherever required.
to check your
payment status
student(rollNo, name, degree, year, sex, deptNo, advisor)
department(deptId, name, hod, phone)
professor(empId, name, sex, startYear, deptNo, phone)
Course course(courseId, cname, credits, deptNo)
outline enrollment(rollNo, courseId, sem, year, grade)
teaching(empId, courseId, sem, year, classRoom)
preRequisite(preCourseId, courseId)
About
NPTEL ()
deptNo is a foreign key in the student, professor and course relations referring to deptId of
department relation;
Introduction
to Database
Systems () advisor is a foreign key in the student relation referring to empId of professor relation;
Week 0 () hod is a foreign key in the department relation referring to empId of professor relation;
Week 1 () rollNo is a foreign key in the enrollment relation referring to rollNo of student relation;
Week 2 () courseId is a foreign key in the enrollment, teaching relations referring to courseId of course
relation;
Week 3 ()
empId is a foreign key of the teaching relation referring to empId of professor relation;
Week 4 ()
preCourseId and courseId are foreign keys in the preRequisite relation referring to courseId of
the course relation.
Week 5 ()
https://onlinecourses.nptel.ac.in/noc25_cs40/unit?unit=47&assessment=181 1/5
2/26/25, 10:02 AM Introduction to Database Systems - - Unit 8 - Week 5
Data 1) Which of the following SQL sub-language constructs are used to insert rows into 2 points
definition tables?
using SQL
(unit? DDL
unit=47&lesso DML
n=48)
Transaction control language
Basic SQL None of the above
query block
and
2) Which of the following relational calculus operators does not have an equivalent 2 points
subqueries
keyword in SQL?
(unit?
unit=47&lesso
exists (∃)
n=49)
for all (∀)
Correlated
and (∧)
subqueries
(unit? None of the above
unit=47&lesso
n=50) 3) Suppose that in the given schema, we want to change the teaching table and add 2 points
Lecture Slides
an extra column called ‘teachingAssistant’. A teaching assistant is a student who assists the
(unit? professor of a course in clarifying student-doubts, setting up quizzes and evaluating students etc.
unit=47&lesso Assume that each course is allotted at most one teaching assistant. Which of the following
n=51) commands is suitable to enforce the above requirement?
https://onlinecourses.nptel.ac.in/noc25_cs40/unit?unit=47&assessment=181 2/5
2/26/25, 10:02 AM Introduction to Database Systems - - Unit 8 - Week 5
6) Suppose we need to find the roll numbers of students whose grades are neither ‘U’2 points
nor ‘W’ in the course having id ‘CS123’. What is the correct SQL query?
7) Which of the following queries would find the students who enrolled in a course 2 points
twice (Note that a course is usually offered once in a year but some popular courses are offered
in both the semesters of the same year)?
SELECT e1.rollNo
FROM enrollment e1
WHERE EXISTS (SELECT * FROM enrollment e2
WHERE e1.rollNo = e2. rollNo and e1.courseId = e2.courseId)
SELECT e1.rollNo
FROM enrollment e1
WHERE EXISTS (SELECT * FROM enrollment e2
WHERE e1.rollNo = e2. rollNo and e1.courseId = e2.courseId
and e1.year = e2.year and e1.sem = e2.sem)
SELECT e1.rollNo
FROM enrollment e1
WHERE EXISTS (SELECT * FROM enrollment e2
WHERE e1.rollNo = e2. rollNo and e1.courseId = e2.courseId
and e1.year != e2.year and e1.sem != e2.sem)
SELECT e1.rollNo
FROM enrollment e1
WHERE EXISTS (SELECT * FROM enrollment e2
WHERE e1.rollNo = e2. rollNo and e1.courseId = e2.courseId
and (e1.year != e2.year or e1.sem != e2.sem))
8) Consider the following query to retrieve the most senior professor (determined 2 points
based on startYear) :
SELECT p1.name
FROM professor p1
WHERE p1.startYear ---------- (SELECT p2.startYear
FROM professor p2)
Which of the following options is the correct filler for the blank ?
< ALL
<= ALL
<= ANY
IN
https://onlinecourses.nptel.ac.in/noc25_cs40/unit?unit=47&assessment=181 3/5
2/26/25, 10:02 AM Introduction to Database Systems - - Unit 8 - Week 5
9) Which of the following queries would find the courses with at least two 2 points
prerequisites?
SELECT *
FROM course c1
WHERE EXISTS (SELECT * FROM prerequisite p1
WHERE p1.courseId = c1.courseId)
AND EXISTS (SELECT * FROM prerequisite p2
WHERE p2.courseId = c1.courseId)
SELECT *
FROM course c1
WHERE EXISTS (SELECT * FROM prerequisite p1
WHERE p1.courseId = c1.courseId)
AND EXISTS (SELECT * FROM prerequisite p2
WHERE p2.courseId = c1.courseId
AND p1.preCourseId <> p2.preCourseId)
SELECT *
FROM course c1
WHERE EXISTS (SELECT * FROM prerequisite p1, prerequisite p2
WHERE p1.courseId = c1.courseId
AND p2.courseId = c1. courseId)
SELECT *
FROM course c1
WHERE EXISTS (SELECT * FROM prerequisite p1, prerequisite p2
WHERE p1.courseId = c1.courseId
AND p2.courseId = c1. courseId
AND p1.preCourseId <> p2.preCourseId)
The query executes only if rollNo of student and empId of professor have same data
types
The query executes in all cases (irrespective of the data types of rollNo and empId)
The query does not execute at all
None of the above
You may submit any number of times before the due date. The final submission will be
considered for grading.
Submit Answers
https://onlinecourses.nptel.ac.in/noc25_cs40/unit?unit=47&assessment=181 4/5
2/26/25, 10:02 AM Introduction to Database Systems - - Unit 8 - Week 5
https://onlinecourses.nptel.ac.in/noc25_cs40/unit?unit=47&assessment=181 5/5