Русский    English

Exercise #151 page 4

Solution 3.5.3

  1. SELECT name
  2. FROM Ships
  3. WHERE launched < 1941
  4. UNION
  5. SELECT ship
  6. FROM Outcomes, Battles
  7. WHERE name = battle AND
  8. DATEPART(YEAR, date) < 1941
  9. UNION
  10. SELECT ship
  11. FROM Outcomes
  12. WHERE ship IN (SELECT class
  13. FROM Ships
  14. WHERE launched < 1941
  15. )
  16. UNION
  17. SELECT name
  18. FROM Ships
  19. WHERE name IN (SELECT class
  20. FROM Ships
  21. WHERE launched < 1941
  22. );

How a lot of interesting things can be taken from this problem, only having changed a year!

However it is not yet all. We suggest you to find the additional ships responding conditions of the problem by yourself. Check yourself up by glancing into T&S.


To solve the problem on SQL-EX.RU

Bookmark and Share
Pages 1 2 3 4
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.