Exercise #55 page 3 |
||
Solution 3.11.3 (comments belong to author of solution)
This solution takes into account all classes, include that which hasn`t ships in DB (the last query in union). Seemingly, mistake of this solution results from attempting to account lead ships (which is the first ships in classes, therefore they have minimal year of launch) and classes which isn`t have lead ships in DB. Let`s imagine situation when launch year of ship is unknown (NULL value), but ship is presents in Ships table. In the mean time, Ships table contains ship with the same class with known launch year. Then just this year must be in resulted set. But this solution returns NULL, meantime the ship with known year will be ignored due to the following filtration:
Such mistake is contains in the next solution. It suggested to analyze it by your own. Solution 3.11.4
|