Need Help Question 2 (4 points) HAPPY INSURANCE Observe the HAPPY INSURANCE DATA
ID: 3708391 • Letter: N
Question
Need Help
Question 2 (4 points) HAPPY INSURANCE Observe the HAPPY INSURANCE DATABASE: CLIENT ClientiD ClientName ClientAgent ClientSpouseName C111 Tom A1 Jenny C222 Karin A1 Bilf 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 ArealD AreaNameAreaHQ 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 SET-TO-NULL 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 recordsExplanation / Answer
ANSWER IS
CLIENT will have 7 records
AGENT will have 3 Records
Option C
Execution of HAPPY INSURANCE DATABASE:
CREATE TABLE CLIENT(ClientId integer PRIMARY KEY, ClientName text,ClientAgent text,ClientSpouseName text);
insert into CLIENT(ClientId, ClientName,ClientAgent,ClientSpouseName) values (C111,'TOM','A1','Jenny');
insert into CLIENT(ClientId, ClientName,ClientAgent,ClientSpouseName) values ('C222','Karin','A1','Bill');
insert into CLIENT(ClientId, ClientName,ClientAgent,ClientSpouseName) values ('C333','Cole','A2','Amy');
insert into CLIENT(ClientId, ClientName,ClientAgent,ClientSpouseName) values ('C444','Dorothy','A2','');
insert into CLIENT(ClientId, ClientName,ClientAgent,ClientSpouseName) values ('C555','Andy','A3','Amy');
insert into CLIENT(ClientId, ClientName,ClientAgent,ClientSpouseName) values ('C666','Tina','A3','Matt');
insert into CLIENT(ClientId, ClientName,ClientAgent,ClientSpouseName) values ('C777','Christina','A4','Mike');
Number of Records: 7
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
CREATE TABLE AGENT(AgentId text references CLIENT(ClientAgent) on delete set NULL, AgentName text,AgentArea text,AgentRating text,AgentYearofHire text,SupervisedBy text);
insert into AGENT(AgentId,AgentName,AgentArea,AgentRating,AgentYearofHire,SupervisedBy) values ('A1','KATE','1','101','1990','');
insert into AGENT(AgentId,AgentName,AgentArea,AgentRating,AgentYearofHire,SupervisedBy) values ('A2','AMY','2','92','2009','A1');
insert into AGENT(AgentId,AgentName,AgentArea,AgentRating,AgentYearofHire,SupervisedBy) values ('A3','LUKE','3','100','1992','');
insert into AGENT(AgentId,AgentName,AgentArea,AgentRating,AgentYearofHire,SupervisedBy) values ('A4','JAMES','3','90','2010','A3');
Number of Records: 4
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
CREATE TABLE AREA(AreaID integer PRIMARY KEY,AreaName text,AreaHQ text);
insert into AREA(AreaID,AreaName,AreaHQ) values (1,'East','Boston');
insert into AREA(AreaID,AreaName,AreaHQ) values (2,'West','San Francisco');
insert into AREA(AreaID,AreaName,AreaHQ) values (3,'Central','Chicogo');
Number of Records: 3
AreaID
AreaName
AreaHQ
1
East
Boston
2
West
San Francisco
3
Central
Chicogo
After Deletion of( 'A4','JAMES','3','90','2010','A3')
delete from AGENT where AgentID='A4'
CLIENT TABLE
Number of Records: 7
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 TABLE
Number of Records: 3
AgentId
AgentName
AgentArea
AgentRating
AgentYearofHire
SupervisedBy
A1
KATE
1
101
1990
A2
AMY
2
92
2009
A1
A3
LUKE
3
100
1992
ANSWER IS
CLIENT will have 7 records
AGENT will have 3 Records
Option C
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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.