Database Reference
In-Depth Information
Figure 20.5
Using CHECK
Constraints.
INSERT INTO ARTISTS VALUES
(1,'Paul McCartney','London',NULL,' Japan ',1,0,0);
INSERT INTO ARTISTS VALUES
(1,'Paul McCartney','London',NULL,'England', 0 , 0 , 0 );
INSERT INTO ARTISTS VALUES
(1,'Paul McCartney','London',NULL,'England',1,0,0);
INSERT INTO ARTISTS VALUES
(2,'Rickie Lee Jones','New York',' N ','USA',1,0,0);
INSERT INTO ARTISTS VALUES
(2,'Rickie Lee Jones','New York','NY','USA',1,0,0);
In Figure 20.5, for the first INSERT command, Japan is not an allowed
country. For the second INSERT command, at least one of the three mone-
tary amounts must be greater than zero to make their sum greater than zero.
In the fourth INSERT command, the state is incorrectly typed as a single
character and thus violates both the two-character length limit and the
NULL check constraint.
Search WWH ::




Custom Search