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:

  1. A.

    CREATE ASSERTION 'ASSERTION Name' CHECK 'Predicate'

  2. B.

    CREATE ASSERTION 'ASSERTION Name'

  3. C.

    CREATE ASSERTION, CHECK 'Predicate'

  4. 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.

Explore the full course: Mppsc Assistant Professor