Professional Documents
Culture Documents
Tables
Tables
These attributes also have constraints that ensure that only numbers representing valid
time values appear in those attributes. This version of the schema for time...slot works
on all databases, including Oracle. Note that although Oracle supports the datetime
datatype, datetime includes a specific day, month, and year as well as a time, and is
not appropriate here since we want only a time. There are two alternatives to splitting
the time attributes into an hour and a minute component, but neither is desirable. The
first alternative is to use a varchar type, but that makes it hard to enforce validity con
straints on the string as well as to perform comparison on time. The second alternative
is to encode time as an integer representing a number of minutes ( or seconds) from
midnight, but this alternative requires extra code with each query to convert values be
tween the standard time representation and the integer encoding. We therefore choose
the two-part solution.
Sample Data
I course_id I prereq_id
BIO-301 BIO-101
BIO-399 BIO-101
CS-190 CS-101
CS-315 CS-101
CS-319 CS-101
CS-347 CS-101
EE-181 PHY-101