Books and articles about SQL Rambler's Top100 Сменить язык на: Русский 27 May 2024 16:28:36
Skip Navigation Links  


Print  Print version

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

Print  Print version

Usage of any materials of this site is possible
only under condition of mandatory allocation of the direct link to a site
on each page where used materials are placed.

 Main   Articles    Books 
Рейтинг Rambler's Top100 Alt Упражнения по SQL: обучение, тестирование, сертификация по языку SQL Copyright c 2002-2006. All rights reserved.