Hi there,
CREATE TABLE class_list
(studentId INTEGER,
grade INTEGER CONSTRAINT grade12 CHECK (grade <= 100) NOT ENFORCED)
Error:
08:57:47.877 DBMS SAMPLE -- Error: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "ENFORCED" was found following "K (grade <= 100) NOT". Expected tokens may include: "REFERENCES". SQLSTATE=42601
And,
ENFORCED or NOT ENFORCED
Specifies whether the constraint is enforced by the database manager during normal operations such as insert, update, or delete. The default is ENFORCED.
ENFORCED
The constraint is enforced by the database manager. 7 ENFORCED cannot be specified for a functional 7 dependency (SQLSTATE 42621). 7 ENFORCED cannot be specified when a referential 7 constraint refers to a nickname (SQLSTATE 428G7).
NOT ENFORCED
The constraint is not enforced by the database manager. This should only be specified if the table data is independently known to conform to the constraint.
What's that meaned to the "NOT ENFORCED"?
and the following contents of the CLASS_LIST table:
STUDENTID GRADE
----------------- -----------
98 100
123 123
101 98
How many records will be retrieved by the following statement? SELECT * FROM class_list WHERE grade = 123?
If the row can be inserted into table, why it can not be retrived?
Merry Christmas to every body,