loading..
Русский    English
16:36

Exercise #70 (tips and solutions)

Here we want to consider some transparent solution with two slight mistakes. Here is it (pay attention on commentaries):

Console
Execute
  1. SELECT q.battle
  2. FROM (
  3. --Determine ships from Ships table which taking part in battles
  4. SELECT Outcomes.battle, Outcomes.ship, Classes.country
  5. FROM Classes INNER JOIN
  6. Ships ON Classes.class = Ships.class INNER JOIN
  7. Outcomes ON Ships.name = Outcomes.ship
  8. UNION
  9. --Determine leading ships from the Outcomes table
  10. SELECT Outcomes.battle, Outcomes.ship, Classes.country
  11. FROM Outcomes INNER JOIN
  12. Classes ON Outcomes.ship = Classes.class
  13. ) AS q
  14. GROUP BY q.battle
  15. HAVING COUNT(q.country) >= 3;

We hope that you`ll easily find this two mistakes and correct it.

To return to discussion of exercise #70

To solve a problem on SQL-EX.RU

Bookmark and Share
The book was updated
several days ago
©SQL-EX,2008 [Evolution] [Feedback] [About] [Links] [Team]
All right reserved.
Rambler's Top100