This worksheet uses the Classic Models database available from the MySQL Tutorial site. This covers the operations of a wholesale business selling scale models of cars, planes, trains, ships etc. to retailers.
The SQL queries here use a combination of the techniques covered over the first half of the semester, so some are straightforward while some require more thought. Try to use the more complex constructs (such as nested or correlated queries) only when they are required.
+------------------+
| Classic Cars |
| Motorcycles |
...
+------------------+----------+
| Classic Cars | 38 |
| Motorcycles | 13 |
...
+-----------------------------------+
| Land of Toys Inc. |
| Gift Depot Inc. |
...
NULL
causes subtle but major problems with NOT IN
so you have to ensure that any set you create contains no NULL
values.)+--------------------------------+
| Diane Murphy |
| Mary Patterson |
+----------------+----------+
| 1002 | 2 |
| 1056 | 4 |
...
| 1165 | 1081530.54 |
| 1166 | 347533.03 |
...
+-------------+
| 10105 |
| 10106 |
| 10117 |
+-------------+
| 10104 |
| 10105 |
| 10106 |
+-------------+
| 10105 |
| 10117 |
| 10128 |
Written with StackEdit.