loading..
Русский    English
21:05

Exercise #20

Find the makers producing at least three distinct models of PCs. Result set: maker, number of models.

The beginners frequently ask: "Why the answer for this task is estimated by the system as correct that the producer E has three distinct models, whereas the query

 

Console
Execute
  1. SELECT Product.maker, PC.model
  2. FROM PC, Product
  3. WHERE Product.model=PC.model;
give us only one model for this producer?"  

Models which are produced in principle are in the Product table. We can say that the PC table contains only the PCs available now. Join of tables restrict result set only by the models (more correctly, PC units) available in PC table.

Since the exercise asks us about models but not about PCs, only the Product table is to be analysed; as a result the missing models will be found.

To solve the problem on SQL-EX.RU

Bookmark and Share
Tags
aggregate functions Airport ALL AND AS keyword ASCII AVG Battles Bezhaev Bismarck C.J.Date calculated columns Cartesian product CASE cast CHAR CHARINDEX Chebykin check constraint classes COALESCE common table expressions comparison predicates Computer firm CONVERT correlated subqueries COUNT CROSS APPLY CTE data type conversion data types database schema date/time functions DATEADD DATEDIFF DATENAME DATEPART DATETIME DDL DEFAULT DEFAULT VALUES DELETE DISTINCT DML duplicates EXCEPT exercise (-2) exercise 19 exercise 23 exercise 32 More tags
The book was updated
several days ago
©SQL-EX,2008 [Evolution] [Feedback] [About] [Links] [Team]
All right reserved.
Rambler's Top100