You are on page 1of 2

EXERCISE 5: SQL subqueries & set theoretic functions

Faculty Name: Dr. Abishi Chowdhury

Lab Slot: L15+L16

Class Number: CH2022235002536


Subject: Database System Lab (BCSE302P)

Date: 08/02/2023
Due Date for Submission: 9/02/2023

1. Create the following relations:


Student (sID: int, sName: varchar2(10), CGPA: int, city: varchar2(15),
phone_number: int)
Apply (sID: int, cName: varchar2(20), stream: varchar2(10))
College(cName: varchar2(20), state: varchar2(15))

Write SQL queries for the following:


2. Insert 10 tuples in each relation.
3. Find IDs and names of students who have applied in CSE stream at some
college.
4. Find the name of student with their CGPA and Sid whose CGPA not equal
to CGPA of Jhon.
5. Find college where students having their names started with S have applied.
6. Find IDs of student and major who applied in any of major Amy had
applied to. But exclude Amy sID from the list.
7. Find sID of student who applied to more or same number of college where
Jay has applied.
8. Find details of Students who applied to stream CSE but not applied to
stream ECE.
9. Find all the colleges such that some other colleges are in the same state.
10. Find name of student having lowest CGPA.
11. Find sID, sName, city of all students NOT from lowest CGPA,
12. Find sID of students who have not applied to DAV college.
13. Find the names of students who applied to all the colleges where sID 12 has applied.
14. Delete applications that are filed to state ‘Boston’.
NOTE: While creating any new table suffix your first name
along with last two digits of your registration number.
Eg: STUDENT_Abishi94

You might also like