Exercise #37 page 1 |
||
Find the classes including only one ship in the database (taking into account Outcomes table). Solution 3.2.1 Here is one of the queries the checking system rejects:
The first request in Union counts the ships of each class in the Ships table leaving only the classes that have one ship in the resulting set. The second request defines classes in which the leading ship is in the Outcomes table on condition that ships of that class are not in the Ships table. Let's examine the following data example for which this request will provide (give) the wrong result. Everyone who has accomplished tasks based on this data scheme (“Ships”) knows what the Bismark is. It's a leading ship which is not included in the Ships table. Now let's imagine that another ship of Bismark's class is included in the Ships table, for example, the Tirpitz. Then the first request will return Bismark's class as the Ships table contains only one ship of that class. The second request won't return Bismark because the predicate:
|