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

Given the following schema, use stored procedures to perform the following tasks

ID: 3688343 • Letter: G

Question

Given the following schema, use stored procedures to perform the following tasks:

Movies(title, year, length, genre, studioName, producerC#)

Starsln(movieTitle, movieYear, starName)

MovieStar(name, address, gender, birthdate)

MovieExec(name, address, cert#, netWorth)

Studio(name, address, presC#)

a) Given the name of a movie studio, produce the net worth of its president.

b)  Given a name and address, return 1 if the person is a movie star but not an executive, 2 if the person is an executive but not a star, 3 if both, and 4 if neither.

Explanation / Answer

DELIMITER $$

DROP FUNCTION IF EXISTS `all`.`PresNetWorth` $$
CREATE FUNCTION `PresNetWorth`(studioName CHAR(15)) RETURNS int(11)
BEGIN

DECLARE presNetWorth INT;


SELECT netWorth
INTO presNetWorth
FROM Studio, MovieExec
WHERE Studio.name = studioName AND presC = cert;
RETURN presNetWorth ;

END $$

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote