Books and articles about SQL Rambler's Top100 Сменить язык на: Русский 24 February 2024 15:50:23
Skip Navigation Links  


Print  Print version

Main page

Typical errors at solution of exercises. Exercise 47

S. Moiseenko

For each working day (i.e. day when waste was collected), find the #1 in payouts in each pair of inlets having the same numbers in the 2 tables - outcome and outcome_o.
Result set: Inlet #, date, text:
- "once a day", if daily reporting inlet is in the lead;
- "more than once a day", if several times a day reporting inlet is in the lead;
- "both", for draw cases.

We have replaced simple, but rather ambiguous from the point of view of the formulation the exercise #47. The new exercise belongs Shurgenz.

Complexity of 2 points is exposed in view of the first stage. Aside from changing the initial formulation verifying data was added.

At once, I'll give the explanations, which actually were brought us to some change of the formulation of this task:

As it was written in the description of a subject domain, the table with a suffix "_o" and without it are two different databases. So, we can consider that they describe business of different firms.

As we compare the points (inlets) having identical numbers, it is necessary to exclude from result set a variant when one table includes a point with number which is absolutely absent in other table. How is it possible to compare something to that which is not present?

Words "day when waste was collected" mean, that if for some date at point in the first table there is a record, but in the second is not present, the first table's point wins. This situation is different, in my opinion, from previous one where the point was simply absent. Absence of the information in this case means that the point simply did not work or idled. In this case the victory is awarded justifiably.

The added data conceptually should make such understanding unequivocal.

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.