Set Theory & Relational Theory for Databases
How do you calculate the cardinality of a given power set for a set with n elements?
2^n n - cardinality of the set (not the power set)
What is set theory?
A branch of study that understands and formalizes the nature of sets.
What is a set?
A collection of distinct objects, or elements, such that given an object, we can determine if they are in a given set.
What is an equality of a given collection of sets defined as?
A given set (S1) is included in another (S2) and S2 is included in S1.
Can a set, in terms of computer data, be infinite? Why or why not?
A given set, as it applies to a computer and data, can not be infinite because computers and physical storage of computer data has to be finite.
What is an attribute in terms of the relational theory/set theory?
A name paired with a data domain, or data type?
What is a dyadic predicate?
A predicate that takes two parameters?
What is a monadic predicate?
A predicate with one parameter.
What is a relation in terms of the relational theory/set theory?
A relation is a set of tuples, which are a set of distinct elements.
How does a SQL relation follow relational theory in terms of uniqueness?
A relation must have a way to uniquely identify entity instances. A given attribute can either only allow for unique values in all rows of the relation, use a uniquely identifying key, or use some other unique constraint.
Describe an empty relation in terms of SQL.
A relation which has at least on attribute but has no tuples.
What is a power set?
A set of all the subsets of a given set. The sets are the elements and thus determine the cardinality.
What is a tuple in terms of the relational theory/set theory?
A set of distinct attribute values. Because attribute values are pairs of elements and attributes, tuples can serve as a way to understand what elements go with what attribute.
What is set inclusion?
A set such it is a subset of another set.
What is a subset?
A set such that all elements of the set are also elements in another set. Thus, all sets are subsets of themselves because they contain all the elements of their own set.
What is a superset?
A set such that all the elements of the set include the elements of a subset and other elements.
What is a universal set?
A set that contains all elements of the concept in question.
What are ordered pairs in set theory?
A set that is defined by two sets: A set of the first element in the ordered set and a set with both elements. ordered pair <x,y> = {{x},{x,y}}
What is the predicate method of describing a set's elements?
A special type of substitution element description such that all variables can be determined to be a part of the set through a true false operator.
What is the result of a Cartesian product of two sets of tuples in terms of databases?
A tuple whose elements are all combinations of the elements in the tuples.
What is a relational variable and what are relational values?
A variable the represents a specific relation, or table. The relational values are the set tuples that satisfy the relational variables at any given time.
What is the substitution method of describing a set's elements?
A way of defining a set such that inclusion in the set is defined by a set of operators or rules, such that a given variable can be determined to be in the given set or not.
What must be true for a cartesian product operation to be doable in relational algebra?
All the tuples in question must have distinct attributes.
What is the extend operation in set theory?
Allows you to create a attribute to a given relation variable and define the attribute values.
What is dyadic operator vs a n-adic operator?
An operator that takes only two operands whereas n-adic operators take n-number of operands.
What is the theory of element categorization that SQL more closely follows?
Bags.
What is the distributive property of set operators and which ones does it apply to?
Distributive Law states that, the sum and product remain the same value even when the order of the elements is altered. A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
What are the common ways to describe the elements of a set?
Enumeration Predicate Substitution
What is the associative property of set operators and which ones does it apply to?
How the sets are grouped an operator does not change the result. Union Intersection Exclusive Union
What is an attribute value in terms of the relational theory/set theory?
It is a attribute paired with an element of that data domain, or data type.
What is the Rename operator?
It is used to change a given attribute for a given tuple.
Can a power set have the same number of elements as its given set?
No, because a power sets denote all the possible sets of a given set, even an empty set as a power set of one, with a set of the empty set. A set with just one element also as two sets in it's power set, the empty set and the set with single element.
What are set operators?
Pre-defined functions that allow you to manipulate sets as defined by the operators.
How does SQL depart from the principles of set theory?
SQL allows for collections of objects such that an element can occur in a given collection more than once, i.e .a bag.
How does set theory apply to SQL?
SQL attempts to show a relation through it's attributes and entity instances. A given relation has a SET of attributes and each entity instance's attributes are set's of tuples.
What are the five primitive operators for relational algebra?
Set Union Set Difference Cartesian Product (cross product/cross join) Selection/Restriction Projection
What are set unions and set differences?
Set unions are unions of two sets as defined by the union operator. Set difference is the complement of a given set.
Subset vs. proper Subset symbols?
Subset: ⊆ Proper Subset: ⊂
Superset vs. proper superset symbols?
Superset: ⊇ Proper Superset: ⊃
What is the difference between an absolute compliment and the relative compliment?
The absolute compliment is the set of all elements in the universal set not in the given set where as the relative compliment is between two sets that are subsets of the universal set.
What does it mean for tuples to be joinable?
The attributes being used to determine JOINs must be of the same data type.
Why do sets not have duplicate elements?
The existence of a given element within a set does not become any more true because the element is in that set more than once. To include duplicate elements would be inefficient.
What is the symbol used to denote subset?
The inclusion symbol ⊆
What is the cardinality of set?
The number of elements within a given set.
Why is it not necessary that a set is ordered?
The ordering of a set does not make the existence of an element in that set any more or less true. When comparing two sets if all the elements in one set can be found in the other, both sets are equal.
What is a predcate?
The parameters under which a proposition is evaluated.
What is set membership?
The property of being an element in a given set S or the process of testing for that property.
What is the complement operator?
The set of all elements in the universal set not in the given set.
What is an exclusive union?
The set of all elements in two sets that are not in both sets.
What is the minus operator?
The set of all elements that are in the set to the left of the operator that are not in the set to the right of the operator.
What is the extension of a monadic predicate?
The set of all elements x such that the predicate evaluates to true.
What is an intersection operator and it's symbol?
The set of elements that occur in all of the sets in question. ⋂
What is a union operator and it's symbol?
The set of elements that occur in any of the sets in questions. ⋃
What does it mean for two ordered pairs to be equivalent in set theory?
The two values in the set must be equal because what you are really doing is looking at the equivalency of two sets (whose elements are sets): <x1,y1> = <x2,y2> {{x1},{x1,y1}} = {{x2},{x2,y2}}
What must be true for set union and set difference to be used in relational algebra?
Two relations in question must have the same set of attributes (which implies sets of unique attributes).
What is the Restriction operator?
Used to create a set of tuples who satisfy the predicate.
What is a proper subset?
When a given set is a subset of another one but not equal to it.
What is a proper superset?
When a given set is a superset of another one but not equal to it.
What is the absorptive property of set operators?
When an operator essentially nullifies the effect of another operator.
What is the commutative property of set operators and which ones have that property?
When the arrangement of the sets that the operator is acting on does not determine it's output. Union Intersect Exclusive Union
What is the idempotent property of set operators?
When the effect of the operator on an operand is an outcome that is the same as the original operand.
What is the symbol used to denote "an element of"?
∈