Database Model:
|
|
|
|
|
Alternative solution:
|
|
Note:
|
|
|
This solution is wrong:
|
The following diagram shows how the query works on an example database, which illustrates why the query is wrong:
|
Notice that:
|
The correct solution is:
|
Rather:
|