Uploaded by prajwaldhakal555

Homework 2

advertisement
Information Systems & Security
COSC 3315
Homework #2
Following is a database of suppliers (S), parts (P), and shipments (SP).
S
SNO
S1
S2
S3
S4
S5
SNAME
Smith
Jones
Blake
Clark
Adams
STATUS
20
10
30
20
30
CITY
London
Paris
Paris
London
Athens
P
PNO
P1
P2
P3
P4
P5
P6
PNAME
Nut
Bolt
Screw
Screw
Cam
Cog
COLOR
Red
Green
Blue
Red
Blue
Red
WEIGHT
12
17
17
14
12
19
SP
SNO
S1
S1
S1
S1
S1
S1
S2
S2
S3
S4
S4
S4
PNO
P1
P2
P3
P4
P5
P6
P1
P2
P2
P2
P4
P5
QTY
300
200
400
200
100
100
300
400
200
200
300
400
CITY
London
Paris
Rome
London
Paris
London
1
Database exercise:
1. Create this database (tables) in SQLite.
2. Retrieve all three tables separately.
3. Make a list of all the different cities where suppliers are located (no repetitions
please)
4. Retrieve the names of all suppliers who ship part P1.
5. Retrieve the names of suppliers that ship screws.
6. Retrieve the names of suppliers that ship screws or bolts.
7. How many parts were shipped by S2?
8. Add a new supplier to table S. (S6, Webb, 45, London)
9. Update the weight for product P5. It should read 14.
10. Delete the record for the supplier S5.
**************************************************************
Database Name: S_P_SP
Table Names: S, P, and SP
Please provide the answers to the above questions using SQL. Then, submit your
answers via Canvas on the due date (#2 ~ #10).
**************************************************************
2
Download