The group by option offers another approach to solving divsion. To divide
the tabular variable T , whose heading is A1 • • •AmB1 • • •Bn by the tabular
variable S whose heading is B1 • • •Bn we compute the number k of distinct
rows in S. Then, we seek to retrieve those m-tuples (a1, . . . , am) that occur in
T and are associated in that tabular variable with at least k distinct tuples.
Example 5.17.5 Recall that in Example 5.12.3 we solved the query “Find
names of instructors who have taught every 100-level course, that is, every
course whose first digit of the course number is 1” by implementing division in
SQL.
Here we determine the number 100-level courses and, then we seek the employee numbers that are associated with all these courses in the GRADES table:
The group by option offers another approach to solving divsion. To divide
the tabular variable T , whose heading is A1 • • •AmB1 • • •Bn by the tabular
variable S whose heading is B1 • • •Bn we compute the number k of distinct
rows in S. Then, we seek to retrieve those m-tuples (a1, . . . , am) that occur in
T and are associated in that tabular variable with at least k distinct tuples.
Example 5.17.5 Recall that in Example 5.12.3 we solved the query “Find
names of instructors who have taught every 100-level course, that is, every
course whose first digit of the course number is 1” by implementing division in
SQL.
Here we determine the number 100-level courses and, then we seek the employee numbers that are associated with all these courses in the GRADES table:
การแปล กรุณารอสักครู่..