Question: There is a table called USER_TABLES that stores the information about each user'stable. Use the select statement to make sure your tables are all created

  1. There is a table called USER_TABLES that stores the information about each user's table. Use the select statement to make sure your tables are all created from assignment 2 (5 marks).

 

  1. I want a new table called "part2" which has the same column definitions as the table "part" you created in assignment2. However, you should not copy the data contained in the course. How do you create a copy of the "part" table without copying its data contents (6 marks)?

 

  1. What is the length of values defined for city column. Modify the length of "city" in the table "suppliers"(5 marks).

 

  1. Are there any constraints defined for the above tables (table suppliers (S), supplier-part (SP), parts? (P) In order to find out, try to search through the USER_CONSTRAINTS table.

 

  1. Add the following constraints for the tables (each 3 marks, total 18 marks):
  • s# is the primary key for table"S"
  • s#, p# is the primary key for the table "SP"

-p# in table "P" should be unique

  • the primary key of the "S" table is posted as foreign key in the tables "SP"
  • SNAME in table "S" may not be NULL
  • the columns "qty" in table"SP", "weight" in table"P" should be largerthan 0.
    1. How many different kinds of parts do we have

 

 

Part 2: More Queries (using the S-SP-P tables)(each 6 marks)

 

  1. Give the details of suppliers in Lodon
  2. Give details of shipments where the quantity shipped is less than200
  3. Give details of partsstored in London
  4. Give the names and numbers of London based suppliers
  5. Give the names of "blue" Parts
  6. Give the part number for parts weighting less than 17


 

  1. Give details of parts supplied by S1
  2. Give the color of parts supplied by S2
  3. Where are the suppliers of P2 located
  4. Get supplier numbers for suppliers who supply parts located in either Paris or London

 

 

Turn in a copy of all of your SQL commands, along with a script illustrating their execution (by using paste your terminal output and save it in a file or any other way). Your scripts should be sufficient to convince us that your commands run successfully.


 

 

S#SNAMESTATUS

CITY

S1SMITH20

LONDON

S2JONES10

PARIS

S3BLAKE30

PARIS

S4CLARKE20

LONDON

S5ADAMS30

ATHENS

Supplier (S)

 

 

 

S#P#Qty
S1P1300
S1P2200
S1P3400
S1P4200
S1P5100
S1P6100
S2P1300
S2P2400
S3P2200
S4P2200
S4P4300
S4P5400

SP

 

 

 

P#PnameColourWeight

City

P1BOLTblue10

London

P2NUTblack5

Paris

P3WASHERblack2

London

P4NUTred6

Athens

P5CAMred8

Paris

P6NUTblue5

London

Step by Step Solution

3.38 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question is complete and covers different aspects of SQL database handling It checks for concept understanding in creating tables ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!