Exercise #46 (tips and solutions)
Example of automatic join of two solutions promised in 3.1 accounting one of two moments leads to mistakes, can look like this (read comments).
The excessive rows like below will be return as a result:
It`s possible to complicate this query more (and make it less efficient), by adding code for exception the wrong row. The presence of NULL-value in displacement column may be a criteria for exception, if there is one else row with the same ship`s name. However, we advice to manage without this solution and solve task by another way. It is possible, and you can make certain of it by visiting cite`s forum.
In conclusion let`s note almost right solution.
The first query from union finds information about ships which is present in the Ships table and had taken part in the battle of Guadalcanal. The second one finds required lead ships in the Outcomes table. The potential duplicates (lead ship is also present in the Ships table) excepts by using UNION clause.
So what`s wrong with this solutuion? If it`s no clear for you, go back to item 3.1 task`s discussion.