Question: CREATE TABLE ACTOR ( ID NUMBER(9,0) NOT NULL, NAME VARCHAR2(100) NOT NULL, CONSTRAINT ACTOR_PK PRIMARY KEY (ID)); CREATE TABLE MOVIE (
CREATE TABLE "ACTOR" ( "ID" NUMBER(9,0) NOT NULL,
"NAME" VARCHAR2(100) NOT NULL,
CONSTRAINT ACTOR_PK PRIMARY KEY (ID));
CREATE TABLE "MOVIE" ( "ID" NUMBER(9,0) NOT NULL,
"TITLE" VARCHAR2(100) NOT NULL "YR" NUMBER(4,0), "SCORE" NUMBER(3,1), "VOTES" NUMBER(9,0), "DIRECTOR" VARCHAR2(100),
CONSTRAINT MOVIE_PK PRIMARY KEY (ID));
CREATE TABLE "CASTING" (
"MOVIE_ID" NUMBER(9,0) NOT NULL
"ACTOR_ID" NUMBER(9,0) NOT NULL
"ORD" CONSTRAINT CASTING_PK Primary Key (Movie_ID, ACTOR_ID), CONSTRAINT CASTING_FK1 FOREIGN KEY (MOVIE_ID) REFERENCES MOVIE(ID),
CONSTRAINT CASTING_FK2 FOREIGN KEY (ACTOR_ID) REFERENCES ACTOR(ID)) ;
Using Pl/Sql
Use two environment variables to prompt the user to input the first name and the last name of a director, respectively. Then show on the screen the number of movies () of those movies that he/she directed. Your output should contain one line , where
James Cameron had directed 4 movies with an average score of 7.85
In case the name of the director (given by the user) does not exist in the movie table, you should catch the runtime error (NO_DATA_FOUND) in your exception-handling section. For example, if the input director is Cameron, James, you should display on the screen that --
Director James Cameron does not exist in the movie table!. Test your code with at least two directors (one exists in the movie table and the other does not).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
