In class project.

We have a small database containing the following tables
Project table description
These tables are located under the schema IST. That is, you can access them as ist.project, etc.

Please express the following queries in SQL:

  1. Get part IDs of parts supplied by a supplier in London to a project in London.
  2. Get part IDs of parts supplied to some project by a supplier in the same city as that project.
  3. Get part IDs for parts supplied to some project in Paris.
  4. Get part IDs for parts that are not supplied to any project in Paris.
  5. Get project IDs for projects that use at least one part that is available from supplier s4.
    Note: get the availability information from the SPJ relation.
    Note: the project need not be supplied by 's4' as long as it uses some part that `s4' supplies.
  6. Find name of suppliers who do not supply any part heavier than 18.
  7. Find name of suppliers that supplies a `Nut'.
  8. Find name of suppliers who do not supply any `Nut's.
  9. Find project IDs of projects that do not use any locally made parts (i.e., if the project takes place in city x, then it does not use any part made in city x).
  10. Find project ID and name of projects that do not use any red parts.
  11. Find project ID and name of projects that only uses red parts.
  12. Get supplier ID and name for suppliers that supply to all projects in 'Rome'.
  13. Get supplier ID and name for suppliers that do not supply to all projects in 'Rome'.
  14. Get supplier ID and name for suppliers that supply to some projects in 'Rome' but not to all projects in 'Rome'.
  15. Find project ID and name of projects that use all parts that are used in project 'j3'.
  16. Find project ID and name of projects that only use parts that are manufactured in the same city where the project takes place.
  17. Find supplier ID and name of suppliers who supply all blue parts but do not supply any green part.
  18. Find supplier ID and name of suppliers who supply some part of every possible color.
    (More clarification: suppose there are only 3 parts 'p1', 'p2' and 'p3'. Part 'p1' is blue, 'p2' is green and 'p3' is blue. Then the suppliers that qualify are those that supply ('p1' and 'p2') or ('p2' and 'p3'). In these cases, the supplier supplies parts of every color.)
  19. Find supplier ID and name of suppliers who supply all the 'Nut' parts.
    (More clarification: suppose 'p1' and 'p2' are 'Nut' parts and there are no more 'Nut' parts other than 'p1' and 'p2'. Then you must find suppliers that supply both 'p1' and 'p2').
  20. Find supplier ID and name of suppliers who only supply to projects in 'Rome'.
  21. Find supplier ID and name of suppliers for which the color of lightest (i.e., minimum weight) part they supply is "Blue".
  22. Find supplier ID and name of suppliers who supply the same part to all projects in the city they live. (For example, if supplier S lives in London, and projects X and Y are in London, then S must supply the same part P to X an Y. Further clarification: if the supplier s1 lives in Paris and j1 and j2 are all the projects in Paris, then s1 is qualified if there is a part p1 that s1 supplies to both j1 and j2. He does not qualify if he supplies p1 to j1 but a different p2 to j2.)
  23. Find supplier ID and name of suppliers who have at least 3 shipments going to projects in every city.
  24. Find project ID and name of project(s) that uses the most number of "Blue" parts.
    Note: use the quantity attribute in SPJ to find number of parts used in project.
  25. Find supplier ID and names of suppliers that can supply every part (PartID) that are used by projects in "Atlanta".
  26. Find project ID and name of projects that uses all but one parts that are available from supplier "s1". For example: if "s1" supplies parts "p1", "p2" and "p3", then find projects that uses {"p1", "p2"} or {"p1", "p3"} or {"p2", "p3"}. You must exclude projects that use all parts available from "s1".
  27. Find project IDs and names of all projects that uses all parts that are heavier than 15.
  28. Get supplier ID and name of suppliers who supply to project `j4' with at least three parts that are also available from supplier 's6' (s6 can supply the parts to any project, not necessarily to j4).