-
What is a key constraint?
(3.2.1)
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)?
(3.2.1)
A set of fields that uniquely identifies a tuple according to a key constraint.
-
What is a superkey?
(3.2.1)
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:
(3.2.1)
- 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.
(3.1.1)
- 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.
(3.1.1)
- INSERT
- 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.
(3.1.1)
- DELETE
- FROM Students S
- WHERE S.name = 'Smith'
|
|