May 2018
Beginner to intermediate
452 pages
11h 26m
English
The lab_check table is an instance of a technician checking all the plots of a lab at a given time on a given date as shown in the following SQL query:
CREATE TABLE lab_checks( date DATE NOT NULL, time TIME NOT NULL, lab_id CHAR(1) NOT NULL REFERENCES labs(id), lab_tech_id SMALLINT NOT NULL REFERENCES lab_techs(id), PRIMARY KEY(date, time, lab_id));
The date, time, and lab_id columns together uniquely identify a lab check, and so we designate them the primary key columns. The ID of the lab technician performing the check is the lone attribute in this table.