Key
- Super key: A set of one or more attributes that uniquely identify a row in a table. May contain extra (redundant) attributes.
- Candidate key: A minimal super key—no attribute can be removed without losing uniqueness. A table may have multiple candidate keys.
- Primary key: One chosen candidate key to uniquely identify rows in the table.
- Foreign key: An attribute (or set of attributes) in one table that refers to the primary key (or candidate key) of another table, creating a relationship between the two tables.
Example
Table: Student(ID, Name, Email, Phone)
{ID}, {Email} → candidate keys (unique and minimal).
{ID, Name} → super key (unique, but not minimal).
{ID} → primary key (chosen candidate key).
- In another table Course(StudentID, CourseName),
StudentID is a foreign key referencing Student(ID).
Relational Algebra
Select
- like
select * from, where
- $\land\ (\text{and}),\ \lor\ (\text{or}),\ \lnot\ (\text{not})$
- The select predicate may include comparisons between two attributes

Project
- like
select ID, name from
