Database Management System: Assignment No-3
Database Management System: Assignment No-3
3. Student(prospectus_no number(10), name varchar(20), address varchar(30), phone_no number(11), D_O_B date,
total_amt number(10,2), amt_paid number(10,2), installment char(1) (I/F))
5. Course_taken(prospectus_no number(10) (foreign key), course_no char(4), start_dt date, full_part char(1) (F/P),
time_slot char(2), performance varchar(20))
SQL Queries:
Q2. Create the following tables and answer the queries: (Take appropriate data types and relationships to
define the columns and then insert relevant data).
1. SUPPLIER(SNO, SNAME, STATUS, CITY)
2. PARTS(PNO, PNAME, COLOR, WEIGHT, CITY)
3. PROJECT(JNO, JNAME, CITY)
4. SPJ(SNO, PNO, JNO, QTY)
SQL Queries:
1) Get sno values for suppliers who supply project j1.
2) Get sno values for suppliers who supply project j1 with part p1.
3) Get jname values for projects supplied by supplier s1.
4) Get color values for parts supplied by supplier s1.
5) Get pno values for parts supplied to any project in London.
6) Get sno values for suppliers who supply project j1 with a red part.
7) Get sno values for suppliers who supply a London or Paris project with a red part.
8) Get pno values for parts supplied to any project by a supplier in the same city.
9) Get pno values for parts supplied to any project in London by a supplier in London.
10) Get jno values for projects supplied by at least one supplier not in the same city.
11) Get all pairs of city values such that a supplier in the first city supplies a project in the second city.
12) Get sno values for suppliers who supply the same part to all projects.
13) Get pno values for parts supplied to all projects in London.
14) Get sname values for suppliers who supplies at least one red part to any project.
15) Get total quantity of part p1 supplied by supplier s1.
16) Get the total number of projects supplied by supplier s3.
17) Change color of all red parts to orange.
18) Get sname values for suppliers who supply to both projects j1 and j2.
19) Get all city, pno, city triples such that a supplier in the first city supplies the specified part to a project in the
second city.
20) Get jnames for those project which are supplied by supplier XYZ.
3|Page