- Formal query languages are based on mathematical relations. Thus no duplicates appear in relations.
- As duplicate removal is expensive, SQL allows duplicates.
- To remove duplicates, we use the distinct keyword.
- To ensure that duplicates are not removed, we use the all keyword.
- Multiset (bag) versions of relational algebra operators.
- if there are c1 copies of tuples t1 in r1, and t1 satis es selection, then there are c1 copies of t1 in
- for each copy of tuple t1 in r1, there is a copy of tuple â…¡A(t1) in â…¡A(r1).
- if there are c1 copies of tuple t1 in r1, and c2 copies of tuple t2 in r2, there is c1c2 copies of tuple t1:t2
in r1 × r2.
- An SQL query of the form
select A1,A2,...,An
from r1,r2,...,rm
where P
is equivalent to the algebra expression
â…¡A1,A2,...,An( P (r1 ×r2×...×rm))
using the multiset versions of the relational operators â…¡, and × .
