You have full access to this open access chapter, Download reference work entry PDF
Synonyms
Definition
The difference of two relation instances R 1 and R 2 over the same set of attributes U, denoted by R 1 − R 2, is another relation instance over U containing precisely the set of tuples occurring in R 1 and not occurring in R 2.
Key Points
The difference is one of the primitive operators of the relational algebra. It coincides with the notion of set difference, with the additional restriction that it can be applied only to relations over the same set of attributes. However the difference of two arbitrary relations having the same arity can be obtained by first renaming attributes in one of the two relations.
As an example, consider a relation Students over attributes (number, name), containing tuples {(1001, Black), (1002, White)}, and a relation Employees over attributes (number, name), containing tuples {(1001, Black), (1003, Brown)}. Then the difference Students − Employees is a relation over attributes (number, name) containing the only tuple (1002, White).
In the absence of attribute names, the difference is defined on two relations with the same arity: the output is a relation with the same arity as the input, containing the difference of the sets of tuples in the two input relations.
The number of tuples in the output relation is bounded by the number of tuples in R 1.
Cross-References
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Section Editor information
Rights and permissions
Copyright information
© 2017 Springer Science+Business Media LLC
About this entry
Cite this entry
Sirangelo, C. (2017). Difference. In: Liu, L., Özsu, M. (eds) Encyclopedia of Database Systems. Springer, New York, NY. https://doi.org/10.1007/978-1-4899-7993-3_1262-2
Download citation
DOI: https://doi.org/10.1007/978-1-4899-7993-3_1262-2
Received:
Accepted:
Published:
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4899-7993-3
Online ISBN: 978-1-4899-7993-3
eBook Packages: Springer Reference Computer SciencesReference Module Computer Science and Engineering