1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Natali [406]
3 years ago
9

Suppliers(sid: integer, sname: string, address: string)

Engineering
1 answer:
GuDViN [60]3 years ago
5 0

Answer:

Explanation:

(a) Find the names of suppliers who supply some yellow part.

RA: sname(Suppliers on (color=0yellow0(Parts) on Catalog))

SQL:

SELECT S.sname

FROM Suppliers S, Parts P, Catalog C

WHERE S.sid = C.sid AND P.pid = C.pid AND P.color =’yellow’

(b) Find the sids of suppliers who supply some green part but not ared part.

RA: sid(Suppliers on (color=0green0(Parts) on Catalog))−

sid(Suppliers on (color=0red0(Parts) on Catalog))

SQL:

SELECT S.sid

FROM Suppliers S, Parts P, Catalog C

WHERE S.sid = C.sid AND P.pid = C.pid AND P.color =’green’

EXCEPT

SELECT T.sid

FROM Suppliers T, Parts P, Catalog C

WHERE T.sid = C.sid AND P.pid = C.pid AND P.color =’red’

(c) Find the sids and snames of suppliers who supply a’bolt’ whose price is under 100

dollars or whose color is red.

There is ambiguity here too. Some of you may interpret the questionto mean a bolt

whose price is under 100 dollars or a bolt whose color is red. Someof you may interpret

it to mean a bolt whose price is under 100 dollars or a red part. Ihave given points to

both these versions.

RA: sid,sname(Suppliers on((pname=0bolt0^cost<100)_(color=0red0)(Parts onCatalog)))

RA: sid,sname(Suppliers on((pname=0bolt0^(cost<100_color=0red0))(Parts onCatalog)))

SQL:

SELECT S.sid, S.sname

FROM Suppliers S, Parts P, Catalog C

WHERE S.sid = C.sid AND P.pid = C.pid AND P.pname =’bolt’ AND C.cost < 100

UNION

SELECT T.sid, T.sname

FROM Suppliers T, Parts P, Catalog C

WHERE T.sid = C.sid AND P.pid = C.pid AND P.color =’red’

SELECT S.sid, S.sname

FROM Suppliers S, Parts P, Catalog C

WHERE S.sid = C.sid AND P.pid = C.pid AND P.pname =’bolt’ AND C.cost < 100

UNION

SELECT T.sid, T.sname

FROM Suppliers T, Parts P, Catalog C

WHERE T.sid = C.sid AND P.pid = C.pid AND P.pname =’bolt’ AND P.color = ’red’

(d) Find the sids of suppliers who supply all parts.

RA: sid((sid,pid(Catalog))/(pid(Parts))

SQL:

SELECT C.sid

FROM Catalog C

WHERE NOT EXISTS (( SELECT P.pid

FROM Parts P )

EXCEPT

(SELECT C1.pid

FROM Catalog C1

WHERE C1.sid = C.sid ))

(e) Find pids of parts supplied by at least two differentsuppliers

RA: (CatPairs(1 !sid1, 2 !pid1, 3 !cost1, 4 !sid2, 5 !pid2, 6!cost2), Catalog×

Catalog)

pid1((pid1=pid2)^(sid16=sid2)CatPairs)

SQL:

SELECT P.pid

FROM Catalog P, Catalog C

WHERE P.pid = C.pid AND P.sid <> C.sid

(f) Find the names of suppliers who supply some brown part.

RA: sname(Suppliers on (color=0brown0(Parts) on Catalog))

SQL:

SELECT S.sname

FROM Suppliers S, Parts P, Catalog C

WHERE S.sid = C.sid AND P.pid = C.pid AND P.color =’brown’

(g) Find the sids of suppliers who supply some yellow part but nota red part.

RA: sid(Suppliers on (color=0yellow0(Parts) on Catalog))−

sid(Suppliers on (color=0red0(Parts) on Catalog))

SQL:

SELECT S.sid

FROM Suppliers S, Parts P, Catalog C

WHERE S.sid = C.sid AND P.pid = C.pid AND P.color =’yellow’

EXCEPT

SELECT T.sid

FROM Suppliers T, Parts P, Catalog C

WHERE T.sid = C.sid AND P.pid = C.pid AND P.color =’red’

(h) Find the sids and snames of suppliers who supply a’nut’ whose price is under 10 dollars

or whose color is pink.

There is ambiguity here too. Some of you interpret the question asa nut whose price is

under 10 dollars or a nut whose color is pink. Some of youinterpret it as a nut whose

price is under 10 dollars and a part whose color is pink. Bothversions are treated as

correct answers.

RA: sid,sname(Suppliers on((pname=0nut0^cost<10)_(color=0pink0)(Parts onCatalog)))

RA: sid,sname(Suppliers on((pname=0nut0^(cost<10_color=0pink0))(Parts onCatalog)))

SQL:

SELECT S.sid, S.sname

FROM Suppliers S, Parts P, Catalog C

WHERE S.sid = C.sid AND P.pid = C.pid AND P.pname =’nut’ AND C.cost < 10

UNION

SELECT T.sid, T.sname

FROM Suppliers T, Parts P, Catalog C

WHERE T.sid = C.sid AND P.pid = C.pid AND P.color =’pink’

SELECT S.sid, S.sname

FROM Suppliers S, Parts P, Catalog C

WHERE S.sid = C.sid AND P.pid = C.pid AND P.pname =’nut’ AND C.cost < 10

UNION

SELECT T.sid, T.sname

FROM Suppliers T, Parts P, Catalog C

WHERE T.sid = C.sid AND P.pid = C.pid AND P.pname =’nut’ AND P.color = ’pink

You might be interested in
11. Technicians A and B are discussing
algol [13]

Answer:

C. Neither Technician A nor B

Explanation:

Just took the test

5 0
3 years ago
The rolling process is governed by the frictional force between the rollers and the workpiece. The frictional force at the entra
adell [148]

Answer:

b)false

Explanation:

Rolling is a process in which work piece passes through rolls to produce desired out put of the work piece.Rolling  is a metal forming process.

We know that friction force is responsible for motion of work piece between rolls.If friction force is so small at the entrance side then work piece will not enter in the forming zone and forming process will not occurs.So the friction force should be high at the entrance side and low at the exit side.

So given statement is wrong.

3 0
3 years ago
. Bơm kiểu piston tác dụng đơn có áp suất p=0,64 Mpa và lưu lượng Q=3,5 l/s. Xác định tốc độ quay của trục bơm và công suất của
Viktor [21]

Answer:

not understand language

4 0
3 years ago
Adding new equipment or processes may require changes to the PPE requirements for
Yuki888 [10]
I think it’s is false I’m not that sure
5 0
2 years ago
Read 2 more answers
Write a program that prompts the user to enter time in 12-hour notation. The program then outputs the time in 24-hour notation.
Juliette [100K]

Answer:

THE CODE FOR THE PROGRAM IS GIVEN BELOW:

#include <iostream>

#include "ConvertTimeHeader.h"

using namespace std;

int main()

{

convertTime convert;

int hr, mn, sc = 0;

 

cout << "Please input hours in 12 hr notation: ";

cin >> hr;

cout << "Please input minutes: ";

cin >> mn;

cout << "Please input seconds: ";

cin >> sc;

 

convert.invalidHr(hr);

convert.invalidMin(mn);

convert.invalidSec(sc);

convert.printMilTime();

 

system("Pause");

 

return 0;  

 

}

#include <iostream>

#include "ConvertTimeHeader.h"

using namespace std;

int convertTime::invalidHr (int hour)

{

try{

 if (hour < 13 && hour > 0)

  {hour = hour + 12;

  return hour;}

 else{

 

  cin.clear();

  cin.ignore();

  cout << "Invalid input! Please input hour again in correct 12 hour format: ";

  cin >> hour;

  invalidHr(hour);

  throw 10;

 }

   

}

catch (int c) { cout << "Invalid hour input!";}

}

int convertTime::invalidMin (int min)

{

try{

 if (min < 60 && min > 0)

  {return min;}

 else{

 

  cin.clear();

  cin.ignore();

  cout << "Invalid input! Please input minutes again in correct 12 hour format: ";

  cin >> min;

  invalidMin(min);

  throw 20;

  return 0;

 }

   

}

catch (int e) { cout << "Invalid minute input!" << endl;}

}

int convertTime::invalidSec(int sec)

{

try{

 if (sec < 60 && sec > 0)

  {return sec;}

 else{

 

  cin.clear();

  cin.ignore();

  cout << "Invalid input! Please input seconds again in correct 12 hour format: ";

  cin >> sec;

  invalidSec(sec);

  throw 30;

  return 0;

 }

   

}

catch (int t) { cout << "Invalid second input!" << endl;}

}

void convertTime::printMilTime()

{

cout << "Your time converted: " << hour << ":" << min << ":" << sec;

}

Explanation:

4 0
3 years ago
Other questions:
  • What is the name of the model/shape below?
    5·2 answers
  • Water is the working fluid in an ideal Rankine cycle. Superheatedvapor enters the turbine at 10MPa, 480°C, and the condenser pre
    10·1 answer
  • Which career related to architecture deals with the planning of entire cities and focuses on designing and arranging buildings,
    9·2 answers
  • Draw an ERD for each of the following situations. (If you believe that you need to make additional assumptions, clearly state th
    15·1 answer
  • What is compression ratio of an Otto cycle? How does it affect the thermal efficiency of the cycle?
    14·1 answer
  • We need to design a logic circuit for interchanging two logic signals. The system has three inputs I1I1, I2I2, and SS as well as
    11·1 answer
  • The shaft is hollow from A to B and solid from B to C. The shaft has an outer diameter of 79 mm, and the thickness of the wall o
    6·1 answer
  • An automobile engine consumes fuel at a rate of 22 L/h and delivers 85 kW of power to the wheels. If the fuel has a heating valu
    8·2 answers
  • Puan puan puan vericim
    5·2 answers
  • 8. What is the purpose of the 300 Log?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!