An Assertion is predicate expressing a condition we wish database to always…
2015
An Assertion is predicate expressing a condition we wish database to always satisfy. The correct syntax for Assertion is:
- A.
CREATE ASSERTION 'ASSERTION Name' CHECK 'Predicate'
- B.
CREATE ASSERTION 'ASSERTION Name'
- C.
CREATE ASSERTION, CHECK 'Predicate'
- D.
SELECT ASSERTION
Attempted by 514 students.
Show answer & explanation
Correct answer: A
Answer: The correct syntax is CREATE ASSERTION assertion_name CHECK (predicate).
Notes: An assertion requires a name and a CHECK clause containing a Boolean expression that the database must always satisfy.
Canonical form: CREATE ASSERTION assertion_name CHECK (predicate)
Example: CREATE ASSERTION positive_balance CHECK (NOT EXISTS (SELECT * FROM account WHERE balance < 0));
Common mistakes:
Omitting the CHECK clause or predicate (the assertion must include a Boolean predicate).
Using incorrect punctuation (for example a comma after CREATE ASSERTION) or incorrect keywords; the structure must be name then CHECK.
Trying to use a SELECT command to create assertions — assertions are defined with CREATE ASSERTION.