Select sname from suppliers except select sname from

Info icon This preview shows pages 3–5. Sign up to view the full content.

(SELECT SNAME FROM SUPPLIERS) EXCEPT (SELECT SNAME FROM SUPPLIERS WHERE NOT EXISTS ((SELECT PID FROM PARTS WHERE COLOR=’Red’) EXCEPT (SELECT PID FROM CATALOG WHERE SUPPLIERS.SID = CATALOG.SID))); 5. For every supplier that only supplies red parts, print the SID and the name of the supplier and the average cost of parts that she supplies. SELECT SID, SNAME, AVERAGE(COST) FROM (CATALOG NATURAL JOIN SUPPLIERS) WHERE NOT EXISTS ((SELECT C.PID FROM CATALOG AS C WHERE SID = C.SID) EXCEPT (SELECT PID FROM PARTS WHERE COLOR=’Red’)) GROUP BY SID, SNAME;
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

6. For each part, find the SNAMEs of the suppliers who do not charge the most for that part.The answer of this query should have two columns: PID and SNAME. SELECT PID, SNAME FROM (SUPPLIERS NATURAL JOIN CATALOG) WHERE (PID, COST) IN (SELECT PID, MIN(COST) FROM CATALOG GROUP BY PID); 7. For every part supplied by a supplier who is at the city of Newark, print the PID and the SID and the name of the suppliers who sell it at the highest price. SELECT PID, SID, SNAME FROM (CATALOG NATURAL JOIN SUPPLIERS) WHERE CITY=’Newark’ AND (PID, COST) IN (SELECT PID, MAX(COST) FROM CATALOG GROUP BY PID); 8. For every part which has at least two suppliers, find its PID, its PNAME and the total number of suppliers who sell it.
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '10
  • WANG
  • Library catalog, New Jersey, Cost curve, Newark, New Jersey, OBD-II PIDs

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern