Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DO NOT USE AI OR GPT SOLVE IT PROPERLY READ THE QUESTION SOLVE Q 1 AND Q 2 YOU HAVE TO FILL IN THE BLANK

DO NOT USE AI OR GPT SOLVE IT PROPERLY
READ THE QUESTION
SOLVE Q1 AND Q2
YOU HAVE TO FILL IN THE BLANK "WRITE DOWN WHAT'S HIDDEN HERE"
Mini-assignment (see 7.5.2)
MovieExec(name, address, cert#, netWorth)
We want to keep the average networth above 50000.
This trigger is for updates.
Write a similar trigger for insertions.
CREATE TRIGGER AvgNetWorthTrigger
AFTER UPDATE OF netWorth ON MovieExec
REFERENCING
OLD TABLE AS OldStuff,
NEW TABLE AS NewStuff
FOR EACH STATEMENT
CREATE TRIGGER AvgNetWorthTrigger2
AFTER INSERT ON MovieExec
Q1: WRITE DOWN WHAT'S HIDDEN HERE
FOR EACH STATEMENT
WHEN (500000>(SELECT AVG(netWorth) FROM MovieExec))
Q2: WRITE DOWN WHAT'S HIDDEN HERE
WHEN (500000>(SELECT AVG(netWorth) FROM MovieExec))
BEGIN
DELETE FROM MovieExec
WHERE (name, address, cert#, netWorth) IN NewStuff;
INSERT INTO MovieExec (SELECT * FROM OldStuff);
END;
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

What does stickiest refer to in regard to social media

Answered: 1 week ago