Professional Documents
Culture Documents
SQL Skill Training V2
SQL Skill Training V2
SQL Skill Training V2
Part 1
Subject
Time Allowed
Prepared Date
Prepared By
Revision
Revised By
Revised Date
1. Create a database named JSE_Test. Place the data file and log file in C:\.
2. Create a table named Supplier under JSE_Test database. Use the following specification.
Column Name
S#
SNAME
STATUS
CITY
Data Type
CHAR(5)
VACHAR(50)
INT
VARCHAR(150)
Allowed Null
NOT NULL
NOT NULL
NOT NULL
NOT NULL
Default Value
3. Create a table named Part under JSE_Test database. Use the following specification.
Column Name
P#
PNAME
COLOR
WEIGHT
CITY
Data Type
CHAR(5)
VARCHAR(50)
VARCHAR(20)
DECIMAL(18,1)
VARCHAR(150)
Allowed Null
NOT NULL
NOT NULL
NOT NULL
NOT NULL
NOT NULL
Default Value
4. Create a table named Project under JSE_Test database. Use the following specification.
Column Name
J#
JNAME
CITY
Data Type
CHAR(5)
VARCHAR(50)
VARCHAR(150)
Allowed Null
NOT NULL
NOT NULL
NOT NULL
Default Value
5. Create a table named Shipment under JSE_Test database. Use the following specification.
Column Name
S#
P#
J#
QTY
Data Type
CHAR(5)
CHAR(5)
CHAR(5)
INT
Allowed Null
NOT NULL
NOT NULL
NOT NULL
NOT NULL
Default Value
SNAME
Smith
Jones
Blake
Clark
Adams
STATUS
20
10
30
20
30
CITY
London
Paris
Paris
London
Athens
Part
P#
P1
P2
P3
P4
P5
P6
PNAME
Nut
Bolt
Screw
Screw
Cam
Cog
COLOR
Red
Green
Blue
Red
Blue
Red
Project
J#
J1
J2
J3
J4
J5
J6
J7
JNAME
Sorter
Display
OCR
Console
RAID
EDS
Tape
CITY
Paris
Rome
Athens
Athens
London
Oslo
London
WEIGHT
12.0
17.0
17.0
14.0
12.0
19.0
CITY
London
Paris
Oslo
London
Paris
London
Shipment
S#
S1
S1
S2
S2
S2
S2
S2
S2
S2
S2
S3
S3
S4
S4
S4
S5
S5
S5
S5
S5
S5
S5
S5
S5
P#
P1
P1
P3
P3
P3
P3
P3
P3
P3
P5
P3
P4
P6
P6
P6
P2
P5
P5
P6
P1
P3
P4
P5
P6
J#
J1
J4
J1
J2
J3
J4
J5
J6
J7
J2
J1
J1
J3
J7
J2
J4
J5
J7
J2
J4
J4
J4
J4
J4
QTY
200
700
400
200
200
500
600
400
800
100
200
500
300
300
200
100
500
100
200
100
200
800
400
500
29. Get project numbers for projects supplied entirely by supplier S1.
30. Get part numbers for parts supplied to all projects in London.
31. Get supplier numbers for suppliers who supply the same part to all projects.
32. Get project numbers for projects supplied with at least all parts available from supplier
S1.
33. Get all cities in which at least one supplier, part or project is located.
34. Get part numbers for parts that are supplied either by a London supplier or to a London
project.
35. Get supplier number/part-number pairs such that the indicated supplier does not supply
the indicated part.
36. Get all pairs of supplier numbers, Sx and Sy say, such that Sx and Sy supply exactly the
same set of parts each. Note: For simplicity, you might want to use the original suppliersand-parts data-base for this exercise, instead of the expanded suppliers-parts-projects
database.
37. Get supplier numbers of those suppliers who supply all red parts.
38. Get part numbers of parts supplied by all London suppliers.
39. Get part numbers of parts supplied by all Paris suppliers who supplies at least one red part.
40. Get project number for projects which are supplied by All London supplier or supplied with at
least all red parts.