Home > Flashcards > Print Preview
The flashcards below were created by user
on FreezingBlue Flashcards. What would you like to do?
What is a key constraint?
A statement that a certain minimal subset of the fields of a relation is a unique identifier for a tuple.
What is a candidate key (or simply key)?
A set of fields that uniquely identifies a tuple according to a key constraint.
What is a superkey?
A set of fields that contains a key.
* Since a relation is a set of tuples, the set of all fields is always a superkey.
Two parts to definition of a key:
- 1: Two distinct tuples in a legal instance cannot have identical values in all of the fields of a key.
- 2: No subset of the set of fields in a key is a unique identifier for a tuple.
Data definition language for creating a relation called Students with columns sid, name, login, age and gpa.
- CREATE TABLE Students(
- sid CHAR(20),
- name CHAR(30),
- login CHAR(20),
- age INTEGER,
- gpa REAL)
Data Definition Language command to insert a tuple into the Students relation with columns for sid, name, login, age, and gpa.
- INTO Students (sid, name, login, age, gpa)
- VALUES (53688, 'Smith', 'smith@ee', 18, 3.2)
Data Definition Language command to delete a tuple from relation Students where name is Smith.
- FROM Students S
- WHERE S.name = 'Smith'