Find the PC makers with all personal computer models produced by them being present in the PC table.
Here is the typical incorrect query
The key point of the task formulation is the word «ALL». Let’s have a look at the models by maker E. PC models produced by maker E are obtained by the following query:
And now let’s check which of these models can be found in the PC table:
As it turns out only one model out of three - 1260 – is present in PC table. According to the task, however, ALL three models should be there for maker E to be displayed.
Basically, the task solution boils down to relational division; however, each maker has his own divisor (the set of models by him). The simplified representation of relational division looks as follows:
Here, the dividend (À) is a binary relation (with two attributes), and the divisor (B) is a unary one. The quotient contains the values of the first attribute in the dividend for which the second attribute has ALL of the values in the divisor.
Relational division doesn’t belong to primitive operations. This means it can be expressed through other (primitive) relational operations. The redundancy of relational algebra introduced by Codd is induced by its focus on practical application. SQL itself is redundant too, which is proved by every exercise at the site that can be solved in different ways. In spite of that, there is no relational division counterpart in SQL. :-)
Finally, here's an example how relational division can be performed using other operations.
Here, A[a] is the projection of the relation A onto attribute a; TIMES is the Cartesian product operation. An “interlinear” translation of the right part of the equation into 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 language could look like this:
It’s hardly advisable to use this word-for-word translation as an action guide; there are easier ways to solve this task. I don’t insist though. :-)