Question

You may use the SQL Handout given out in class. The database is called the suppliers-parts-projects database. S, P, J, and SPJ are the 4 tables. S is the Suppliers table P is the Parts table Jis the Projects table and SPJ is where a specified supplier supplies the specified part to the specified project in the specified quantity. NOTE: The database is on the last page of this test, you may detach this from the rest of the test.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q 1:

Select * from J;

Q 2:

Select * from J where City = 'London';

Q 3:

Select P# from P where Weight = (Select min(Weight) from P);

Q 4:

Select S# from S , SPJ where S.S#= SPJ.S# and SPJ.J# = 'J1';

Q 5:

Select S# from S ,SPJ ,P where S.S# = SPJ.S# and P.P# = SPJ.P# and SPJ.J# = 'J1' and P.P#= 'P1';

Q 6:

Select JName from J , SPJ where J.J# = SPJ.J# and SPJ.S# = 'S1';

Q 7:

Select Color from P , SPJ ,S where P.P# = SPJ.P# and SPJ.S# = S.S# and S.S# ='S1';

Q 8:

Select S# from S , SPJ where S.S# = SPJ.S# and SPJ.J# = 'J1' and SPJ.J# = 'J2';

Q 9:

Select S# from S , SPJ ,P where S.S# = SPJ.S# and P.P# = SPJ.P# and J.J# ='J1' and P.Color = 'Red';

Q 10:

Select P# from P, SPJ ,J where P.P# = SPJ.P# and SPJ.J# = J.J# and J.City = 'London';

Q 11:

Select P# from P, SPJ ,J ,S where P.P# = SPJ.P# and SPJ.J# = J.J# and SPJ.S# = S.S# and S.City = P.City;

Q 12:

Select J# from J , SPJ,P,S where J.J# = SPJ.J# and SPJ.P# = P.P# and SPJ.S# = S.S# and S.City != J.City;

Q 13:

Select J# from J , SPJ ,P ,S where J.J# = SPJ.J# and SPJ.P# = P.P# and SPJ.S# = S.S# and S.# = 'S1';

Q 14:

Select S.City,P.City from S , SPJ,P where S#.S = SPJ.S# and SPJ.P# = P.P# and S.City = P.City;

Q 15:

Select S.City,P.P#,P.City from S, SPJ ,P where S#.S = SPJ.S# and SPJ.P# = P.P# and S.City = P.City;

Q 16:

Update J set JName = 'VIDEO' where J# = 'J6';

Q 17:

Update P set Color ='Orange' where Color = 'Red';

Q 18:

Select sum(P.P#) from P,SPJ,S where P.P# = SPJ.P# and S.S# = SPJ.S# group by S.S# having S# = 'S3';

Q 19:

Select sum(P.Weight) from P ,SPJ ,S where P.P# = SPJ.P# and S.S# = SPJ.S# group by S.S# having S# = 'S1';

Q 20:

Select P.P#,J.J#,sum(Weight) from P ,SPJ ,S where P.P# = SPJ.P# and S.S# = SPJ.S# group by P.P# ;

Do ask if any doubt. Please upvote.

Add a comment
Know the answer?
Add Answer to:
You may use the SQL Handout given out in class. The database is called the suppliers-parts-projects...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem 3 [40 points, Formal Query Languages]| Consider the following relational schema to represent information about...

    Problem 3 [40 points, Formal Query Languages]| Consider the following relational schema to represent information about suppliers S, parts P, and projects J, S#, P#, and J# are primary keys for S, P, and J respectively. For a tuple of SPJ, a particular supplier supplies a specific part to a specific project in the specified quantity S(S#, SNAME, STATUS, CITY) P(P#, PNAME, COLOR, WEIGHT, CITY) J(J#, JNAME,CITY) SPJ(S# P# J#, QTY) Write queries for the following requests in specified languages....

  • Consider a database schema with three relations: - Parts (pid:integer, pname:string, year:integer, price:integer) -Suppliers (sid:integer, sname:...

    Consider a database schema with three relations: - Parts (pid:integer, pname:string, year:integer, price:integer) -Suppliers (sid:integer, sname: string, state:string, zipcode:string) -Orders (pid:integer, sid:integer, quantity:integer) The description is as follows: a factory keeps a database with parts that it uses, the suppliers of those parts, and purchase orders. Each part is uniquely identified by pid. Each part has a string description pname, year of fabrication and price per unit. Parts are provided by suppliers, and each supplier is uniquely identified by sid....

  • database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED...

    database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE Department ( DECIMAL(5) VARCHAR(30) CHAR(5) DATE NOT NULL NOT NULL NOT NULL * Department number /*Department name * Department manager number */ /Manager start date DNumber DName Manager MSDate CONSTRAINT Department_PK PRIMARY KEY(DNumber) CONSTRAINT Department_CK UNIQUE(DName) CREATE TABLE DeptLocation DECIMAL(5) VARCHAR(50) NOT NULL NOT NULL DNumber * Department number */ * Department location */ Address CONSTRAINT DeptLocation_PK PRIMARY KEY(DNumber, Address) CONSTRAINT...

  • #1) Display Last Name, First Name, DonorId, Fundname, TotalPledged from the donor’s database (you may need...

    #1) Display Last Name, First Name, DonorId, Fundname, TotalPledged from the donor’s database (you may need to use donor and pledge tables to get the information) for Donor ID 59034. (Your results window should have 3 rows) #2) Display all records from the PurchaseOrderHeader from the AdventureWorks Database that were sold by Employee 261 (Your results window should have 401 rows) #3) Display salesorderid, orderdate, totaldue, and territory name from salesorderheader and salesterritory for all totaldue that are greater than...

  • Please finish all 6 parts with indexing SQL. Don't need to do the measure time things, but you can do it if you wanna do it. Thanks! Write the following SQL queries and measure their execution t...

    Please finish all 6 parts with indexing SQL. Don't need to do the measure time things, but you can do it if you wanna do it. Thanks! Write the following SQL queries and measure their execution time both with and without using indexes 1. Count how many parts in NYC have more than 70 parts on hand 2. Count how many total parts on hand, in both NYC and SFO, are Red 3. List all the suppliers that have more...

  • I need help with the following SQL query for a company database (script given below). The...

    I need help with the following SQL query for a company database (script given below). The name of the Department. The number of employees working in that department. The number of different projects controlled by this department. The name of the project controlled by this department that has the maximum number of employees of the company working on it. The number of the above project. The cumulative sum of the number of employees of the company working on the projects...

  • Questions in this part ask you to write SQL queriesthat would retrieve certain information from the...

    Questions in this part ask you to write SQL queriesthat would retrieve certain information from the tables. For each question, write the SQL query that would display the information asked by the question. Display information about parts that have their weights greater than the average weight of all parts.   PNO PNAME P2 BOLT P3 SCREW Find supplier numbers who supply any screws (i.e., such that the part name is ‘screw’).  The constraint is that you may not use any join or...

  • Instructions Try to answer all the questions using what you have learned in class. Please make...

    Instructions Try to answer all the questions using what you have learned in class. Please make your query general not data related This schema is used for inventory management for an OEM Part Inventory p_id Name Cost Supplier Location 1 Traction motor 200 Melco Japan 2 Alternator 400 kato USA 3 HVAC 300 Melco Japan p_id Warehouse_id quantity 1 A1 100 2 A2 250 3 B1 300 Customer Model c_id Name Location CN Canada National Canada UP Union Pacific USA...

  • You are given a database in a MS Access file called ‘DBP-e14-Cape-Codd’ that contains data collected...

    You are given a database in a MS Access file called ‘DBP-e14-Cape-Codd’ that contains data collected in an outdoor sports retail store. The retail store hired you as a data analyst to answer questions in order to help them make business decisions that will help them grow. Write the SQL statement for each query and save them in MS Access as Q1, Q2,… Please submit the MS Access and MS Word to help speed the grading turnout! in Blackboard. (to...

  • Project Description In this project, you will design and implement a database for keeping track of...

    Project Description In this project, you will design and implement a database for keeping track of information for an online “SOCIAL NETWORK” system (e.g. a simplified version of Facebook!). You will first design an EER schema diagram for this database application. Then, you will map the EER schema into a relational database schema and implement it on ORACLE or MySQL or some other relational DBMS. Finally, you will load some data into your database (via user Interface) and create some...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT