Hardik Choudhary N212, 70471118013 Part B
Hardik Choudhary N212, 70471118013 Part B
Hardik Choudhary N212, 70471118013 Part B
N212 ,70471118013
PART B
Q.1 Write the following simple SQL Queries on the University Schema
a. Find the names of all the students whose total credits are greater than 100
b. Find the course id and grades of all courses taken by any student named 'Tanaka'
c. Find the ID and name of instructors who have taught a course in the Comp. Sci. department, even
if they are themselves not from the Comp. Sci. department. To test this query, make sure you add
appropriate data, and include the corresponding insert statements along with your query.
d. Find the courses which are offered in both 'Fall' and 'Spring' semester (not necessarily in the same
year).
e. Find the names of all the instructors from Comp. Sci. department
f. Find the course id and titles of all courses taught by an instructor named 'Srinivasan'
g. Find names of instructors who have taught at least one course in Spring 2009
Q.3 Write the following Queries for Railway Schema
Find pairs of stations (station codes) that have a track (direct connection) with distance less than 20Kms
between them
a. Find the IDs of all the trains which have a stop at THANE
d. Find the name of the trains which have stop at Thane, before the 6th station in the route of the
train.
1. Explain the use of % and _ in pattern matching with suitable examples.
% (percent sign) allows you to match any string of any length (including zero
length)
_ (underscore) allows you to match on a single character.