tailieunhanh - Hướng dẫn học Microsoft SQL Server 2008 part 33
quan hệ phân chia danh sách truy vấn sẽ chỉ có những sinh viên thông qua các khóa học yêu cầu và không có những người khác. Một bộ phận quan hệ với phần còn lại một, còn được gọi là phân chia gần đúng, sẽ liệt kê tất cả những sinh viên thông qua các khóa học yêu cầu và bao gồm những sinh viên thông qua bất kỳ các khóa học bổ sung. | Part II Manipulating Data With Select relational division query would list only those students who passed the required courses and no others. A relational division with a remainder also called an approximate divide would list all the students who passed the required courses and include students who passed any additional courses. Of course that example is both practical and academic. Relational division is more complex than a join. A join simply finds any matches between two data sets. Relational division finds exact matches between two data sets. Joins subqueries and relational division solve different types of questions. For example the following questions apply to the sample databases and compare the two methods Joins subqueries CHA2 Who has ever gone on a tour CHA2 Who lives in the same region as a base camp CHA2 Who has attended any event in his or her home region Exact relational division CHA2 Who has gone on every tour in his or her home state but no tours outside it OBXKites Who has purchased every kite but nothing else Family Which women widows or divorcees have married the same husbands as each other but no other husbands Relational division with remainders CHA2 Who has gone on every tour in his or her home state and possibly other tours as well OBXKites Who has purchased every kite and possibly other items as well Family Which women have married the same husbands and may have married other men as well Relational division with a remainder Relational division with a remainder essentially extracts the quotient while allowing some leeway for rows that meet the criteria but contain additional data as well. In real-life situations this type of division is typically more useful than an exact relational division. The previous OBX Kites sales question Who has purchased every kite and possibly other items as well is a good one to use to demonstrate relational division. Because it takes five tables to go from contact to product category and because the question .
đang nạp các trang xem trước