Java Reference
In-Depth Information
FiguresĀ 32.4 and 32.5. The Course table and the Enrollment table are related through their
common attribute courseId , and the Enrollment table and the Student table are related
through ssn .
Student Table
ssn
deptID
444111110 Jacob R Smith 9129219434 1985-04-09 99 Kingston Street 31435 BIOL
444111111 John K Stevenson 9129219434 null 100 Main Street 31411 BIOL
444111112 George K Smith 9129213454 1974-10-10 1200 Abercorn St. 31419 CS
444111113 Frank E Jones 9125919434 1970-09-09 100 Main Street 31411 BIOL
444111114 Jean K Smith 9129219434 1970-02-09 100 Main Street 31411 CHEM
444111115 Josh R Woo 7075989434 1970-02-09 555 Franklin St. 31411 CHEM
444111116 Josh R Smith 9129219434 1973-02-09 100 Main Street 31411 BIOL
444111117 Joy P Kennedy 9129229434 1974-03-19 103 Bay Street 31412 CS
444111118 Toni R Peterson 9129229434 1964-04-29 103 Bay Street 31412 MATH
444111119 Patrick R Stoneman 9129229434 1969-04-29 101 Washington St. 31435 MATH
444111120 Rick R Carter 9125919434 1986-04-09 19 West Ford St. 31411 BIOL
firstName
mi lastName
phone
birthDate
street
zipCode
F IGURE 32.4
A Student table stores student information.
Enrollment Table
ssn
courseId
dateRegistered
grade
444111110 11111
2004-03-19
A
444111110 11112
2004-03-19
B
444111110 11113
2004-03-19
C
444111111 11111
2004-03-19
D
444111111 11112
2004-03-19
F
444111111 11113
2004-03-19
A
444111112 11114
2004-03-19
B
444111112 11115
2004-03-19
C
444111112 11116
2004-03-19
D
444111113 11111
2004-03-19
A
444111113 11113
2004-03-19
A
444111114 11115
2004-03-19
B
444111115 11115
2004-03-19
F
444111115 11116
2004-03-19
F
444111116 11111
2004-03-19
D
444111117 11111
2004-03-19
D
444111118 11111
2004-03-19
A
444111118 11112
2004-03-19
D
444111118 11113
2004-03-19
B
F IGURE 32.5
An Enrollment table stores student enrollment information.
32.2.2 Integrity Constraints
An integrity constraint imposes a condition that all the legal values in a table must satisfy.
FigureĀ  32.6 shows an example of some integrity constraints in the Subject and Course
tables.
In general, there are three types of constraints: domain constraints, primary key con-
straints, and foreign key constraints. Domain constraints and primary key constraints are
known as intrarelational constraints meaning that a constraint involves only one relation.
The foreign key constraint is interrelational meaning that a constraint involves more than
one relation.
integrity constraint
 
 
Search WWH ::




Custom Search