Bag semantics 2026-10-31
Database query results may contain repeated records, with their multiplicities retained.
Database query plan 2026-10-31
A physical recipe for evaluating a database query, specifying scans, index accesses and implementations of relational joins and duplicate elimination.
Database query safety 2026-10-31
The requirement that a database query have a finite, appropriately range-restricted answer on finite input. In the usual domain-independent interpretation, extending the ambient value domain with unused values must not change the answer. The absence of a negation symbol alone does not ensure safety.
A database query has the same result when its ambient domain is extended while all input database relations are unchanged.
Assume the two database queries have compatible output database attributes. Then
For a finite input database, the result of the relational difference is a subset of the finite result of , so it is finite and introduces no new values. For the usual domain independence of a database query, let be the input database and let be two ambient value domains containing its data and the query constants. Database query safety gives
and therefore
Although a domain relational calculus expression for the relational difference uses negation, its positive membership requirement in supplies the necessary range restriction. Negation is not by itself a reason for failure of database query safety.
Set semantics 2026-10-31
Database query results contain no repeated database tuples. SQL usually uses bag semantics unless duplicate elimination is requested.