loading..
Русский    English
16:41

Exercise #23 page 1

Find the makers producing at least both a pc having speed not less than 750 MHz and a laptop having speed not less than 750 MHz. Result set: Maker

Query below includes typical mistake peculiar to beginners which solve this exercise.

Solution 1.15.1

Console
Execute
  1. SELECT DISTINCT maker
  2. FROM product
  3. WHERE model IN (SELECT model
  4. FROM PC
  5. WHERE speed >= 750
  6. ) OR
  7. model IN (SELECT model
  8. FROM Laptop
  9. WHERE speed >= 750
  10. );

The mistake lies in the fact that the result set will include a producer which manufactures something one: either PC or laptops, because the predicate in WHERE clause will be true if at least one of two conditions linked with OR operator will be satisfied. This doesn't match the task and is fairly discarded by a system.

T&S

To solve the problem on SQL-EX.RU

Bookmark and Share
Pages 1 2 3 4
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 CONSTRAINT CONVERT correlated subqueries COUNT CROSS APPLY CTE data type conversion data types database schema DATEADD DATEDIFF DATENAME DATEPART DATETIME date_time functions DDL DEFAULT DEFAULT VALUES DELETE DISTINCT DML duplicates edge equi-join EXCEPT exercise (-2) More tags
The book was updated
month ago
©SQL-EX,2008 [Evolution] [Feedback] [About] [Links] [Team]
All right reserved.