Given the following tables:
TABLEA
EMPIDNAME
—– ——-
1 USER1
2 USER2
TABLEB
EMPID WEEKNO PAYAMT
—– —— ——-
1 1 1000.00
1 2 1000.00
2 1 2000.00
and the fact that TABLEB was defined as follows:
CREATE TABLE tableb (empid SMALLINT,
weekno SMALLINT,
payamt DECIMAL(6,2),
CONSTRAINT const1 FOREIGN KEY (empid)
REFERENCES tablea(empid)
ON DELETE NO ACTION)
If the following command is issued:
DELETE FROM tablea WHERE empid=2
How many rows will be deleted from TABLEA and TABLEB?

A.
TABLEA – 0, TABLEB – 0
B.
TABLEA – 0, TABLEB – 1
C.
TABLEA – 1, TABLEB – 0
D.
TABLEA – 1, TABLEB – 1
RESTRICT or NO ACTION – No rows are deleted
SET NULL – Each nullable column of the foreign key is set to null
CASCADE – The delete operation is propagated to the dependents of the parent table. These dependents are said to be delete-connected to the parent table.
RESTRICT constraint rules are checked before any other operation,
NO ACTION constraint rules are checked after the statement and all other operations (such as triggers) are completed.
In most cases, there is no difference between the two options. The difference is visible when the delete operation is triggered by some other operation, such as delete cascade from a different table, delete via a view with a UNION, a trigger, etc.
0
0