Exercise #15 (tips and solutions)
Incorrect solution 1.11.1 for this exercise is easily corrected if is not distinguish PC by model number, but, as expected, by the primary key - column code.
Because it is only two PCs needed with identical hard drives, you can use a self-join the PC table in similar conditions:
However, the optimal solution will be the solution with grouping and conditions of the selection in a HAVING clause:
For completeness, we present another solution that uses a subquery with grouping and which performance is also inferior to the above.
The reason for the low efficiency of the solutions with subqueries is that they all use the correlated subquery, the subquery has to be executed for each row of the main query. Join query has the lowest productivity. This is understandable, since the join operation is very costly, despite the fairly efficient algorithms for their implementation A database management system (DBMS) by Microsoft Corporation. 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 2005" class="e" href="/en/book_bibliography.html">.