Main page
Typical errors at solution of exercises.
Exercise 2
S. Moiseenko
Find printer makers. Result set: maker.
Typical mistake when solving exercise #2 is the query:
select distinct maker
from product, printer
where product.model=printer.model
The Product and Printer tables are in one-to-many relationship. In particular, it
means that Printer table may not involve all the printer models available in Product
table. As a result, the above query will return only those models, which are available
(!) in Printer table.
As we need to find all manufacturers of printers it is necessary to use only Product
table, filtering the printers by using [type] column where product type is pointed.
Main page