Consider the Is A relationship between Student(Id,Major) and Person(Id, Name). Write the triggers appropriate for maintaining this relationship: when a tuple is deleted from Person, the tuple with the same Id must be deleted from Student; when a tuple is inserted into Student, check whether a corresponding tuple exists in Person and abort if not. (Do not use the ON DELETE and ON INSERT clauses

provided by the FOREIGN KEY statement.)

What will be an ideal response?


```
CREATE TRIGGER MaintainStudIsaPerson1
AFTER DELETE ON Person
REFERENCING OLD AS O
FOR EACH ROW
DELETE FROM Student
WHERE Id = O.Id
```

```
CREATE TRIGGER MaintainStudIsaPerson2
BEFORE INSERT ON Student
REFERENCING NEW AS N
FOR EACH ROW
WHEN (NOT EXISTS(
SELECT * FROM Person P
WHERE P.Id = N.Id ) )
ROLLBACK
```

Computer Science & Information Technology

You might also like to view...

A Panel is used to:

a) group or store components b) display text c) create a border around components d) add style to a form

Computer Science & Information Technology

If a function returns a value, it can be stored in a variable.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Inverse kinematics mimic natural movement.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The IT department has setup a website with a series of questions to allow end users to reset their own accounts. Which of the following account management practices does this help?

A. Account Disablements B. Password Expiration C. Password Complexity D. Password Recovery

Computer Science & Information Technology