Attribute
Section titled “Attribute”An atomic value.
Domain
Section titled “Domain”Allowed values for a given attribute. null is a special value which is an element of all domains.
Relation Schema
Section titled “Relation Schema”A set of attributes. Denoted as .
Relation
Section titled “Relation”Given a set of relation schemas , a relation is a subset of .
A set of n-tuples.
Represents a record. Element of a relation.
Relation Instance
Section titled “Relation Instance”Current values of a relation. Represented by a table.
Let .
Superkey
Section titled “Superkey”is a superkey iff values for are sufficient to identify a unique tuple of each possible relation .
is a superkey iff:
No two different tuples have the same values for attributes in .
Candidate Key
Section titled “Candidate Key”A minimal superkey. is a candidate key iff:
- AND
Primary Key
Section titled “Primary Key”A superkey that is chosen as the main identifier of tuples in . Depends on the attributes.
Foreign Key
Section titled “Foreign Key”Value in one relation must appear in another.
Relational Algebra
Section titled “Relational Algebra”A theoritical procedural query language. Defines a set of operations that take one or more relations as input and produce a new relation as output.
Selection
Section titled “Selection”Extracts tuples (rows) satisfying a specified condition. Denoted by .
Projection
Section titled “Projection”Extracts specific attributes (columns) from a relation. Denoted by .
Duplicates are removed by default, as it is a set. Useful for narrowing down the output to required columns.
Combines tuples from two relations. Denoted by .
Result includes all tuples that appear in either or both relations. Both relations must be union-compatible.
Union Compatible
Section titled “Union Compatible”2 relations are union-compatible iff both have the equal number of attributes and associated attributes have equivalent domains.
Set Difference
Section titled “Set Difference”Finds tuples that appear in one relation but not in another. Denoted by .
Requires union compatibility. Used to find “exclusive” records.
Cartesian Product
Section titled “Cartesian Product”Combines every tuple of one relation with every tuple of another. Denoted by .
If has tuples and has tuples, result has tuples. Attributes of both relations are concatenated.
Rename
Section titled “Rename”Assigns new names to relations or attributes. Denoted by .
Used to avoid ambiguity, especially in self-joins or nested queries.
Natural Join
Section titled “Natural Join”Combines tuples from two relations based on matching attribute names and matching values. Denoted by .
Division
Section titled “Division”Finds tuples in one relation associated with all tuples in another. Denoted by .
Typically, has attributes and has attributes . Result contains those values that appear with every value in .