Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

HAPPY INSURANCE Observe the HAPPY INSURANCE DATABASE: CLIENT ClientID ClientName

ID: 3777413 • Letter: H

Question

HAPPY INSURANCE
Observe the HAPPY INSURANCE DATABASE:

CLIENT
ClientID          ClientName       ClientAgent               ClientSpouseName
C111                  Tom                         A1                               Jenny
C222                  Karin                       A1                               Bill
C333                  Cole                         A2                               Amy
C444                  Dorothy                  A2                               
C555                  Andy                       A3                               Amy
C666                  Tina                         A3                               Matt
C777                  Christina                A4                               Mike

AGENT
AgentID       AgentName      AgentArea      AgentRating      AgentYearOfHire     SupervisedBy
A1                    Kate                    1                        101                        1990                               
A2                    Amy                   2                        92                          2009                             A1
A3                    Luke                   3                        100                        1992                               
A4                    James                 3                        90                          2010                             A3

AREA
AreaID          AreaName            AreaHQ
1                       East                         Boston
2                       West                        San Francisco
3                       Central                   Chicago

This database will be used for the following question citing tables from the HAPPY INSURANCE database.

If a DBMS enforces a DELETE RESTRICT option on the referential integrity constraint between CLIENT and AGENT in the HAPPY INSURANCE database, what will be the outcome after a user tries to delete the last record (A4, James, 3, 90, 2010, A3) from AGENT?

CLIENT will have 7 records
AGENT will have 4 records

CLIENT will have 6 records
AGENT will have 3 records

CLIENT will have 7 records
AGENT will have 3 records

CLIENT will have 6 records
AGENT will have 4 records

CLIENT will have 7 records
AGENT will have 4 records

CLIENT will have 6 records
AGENT will have 3 records

CLIENT will have 7 records
AGENT will have 3 records

CLIENT will have 6 records
AGENT will have 4 records

Explanation / Answer

The DELETE RESTRICT command ensures that the parent is deleted but not the children. It means that a given parent row can’t be deleted if a child row exists that references the value for that parent row. If there exists a parent row that does not reference child rows, then parent row can be deleted.

In the HAPPY INSURANCE DATABASE, the parent table is AGENT (Because the primary key AgentID is unique in this table )and the referenced table(child) is CLIENT, then according to the question, the deleted record is (A4, James, 3, 90, 2010, A3) and the deletion takes place from the child table. The primary key is AgentID  and the reference takes place in the CLIENT table, having the foreign key as ClientAgent.

In this case, the deletion is taking place from the parent table but not the child table. So, it will not affect the number of records. Neither the parent table, nor the child table will be affected.

So, the correct option is CLIENT will have 7 records

                                        AGENT will have 4 records