Exercise #151 page 3 |
||
In second query from UNION in the solution 3.5.2 DATEPART function, specific for SQL(Structured Query Language) is a database computer language designed for the retrieval and management of data in relational database management systems (RDBMS), database schema creation and modification, and database object access control management.SQL Server, is used. It is necessary due to date of battle (the "date" column has temporal data type - datetime), from which we should take a year of battle; otherwise the predicate
which gives
To remain within the Standard's frame, it would be possible to use the following predicate:
Then implicit transformation of type would give the result required. Again we shall check up:
Naturally, the predicate containing a full date corresponding to the beginning of 1941 (January, 1) will be correct also:
However let's return to our solution. It is incorrect. As it has been said, the situation when the head ship with unknown launch year is present only in Ships table here is not considered. To consider this situation we should add one more query to the union. |