Computer Science Homework Help

CS 166 University of California Riverside Structured Query Language Coding

 

For those 3 schema

Suppliers (

sid NUMERIC( 9 , 0 ) PRIMARY KEY,

sname CHAR( 3 0 ) ,

address CHAR( 4 0 ) ) ;

Parts (

pid NUMERIC( 9 , 0 ) PRIMARY KEY,

pname CHAR( 4 0 ) ,

color CHAR( 1 5 ) ) ;

Catalog (

sid NUMERIC( 9 , 0 ) ,

pid NUMERIC( 9 , 0 ) ,

cost NUMERIC( 1 0 , 2 ) ,

PRIMARY KEY( sid , pid ) ,

FOREIGN KEY( sid ) REFERENCES Suppliers ,

FOREIGN KEY( pid ) REFERENCES Parts ) ;

Create a script file with the commands in SQL to answer the following
queries:

  • Find the pid of parts with cost lower than 10
  • Find the name of parts with cost lower than 10
  • Find the address of the suppliers who supply “Fire Hydrant Cap”
  • Find the name of the suppliers who supply green parts
  • For each supplier, list the supplier’s name along with all parts’ name that it supply