4. For this problem create a table called instructor_course_nums. Write a procedure that accepts an instructor ID as input. The procedure calculates the total number of course sections taught by that instructor, and adds a tuple to the instructor_course_nums table consisting of the instructors ID number, name, and total courses taught - call these attributes: ID, name, and tot_courses. If the instructor already has an entry in the table, then the procedure makes sure the total number of courses taught in the instructor_course_nums table is up-to-date. You must name your procedure: __insCourseNumsProc

Database Systems: Design, Implementation, & Management
12th Edition
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Carlos Coronel, Steven Morris
Chapter8: Advanced Sql
Section: Chapter Questions
Problem 3P
icon
Related questions
Question

Hi,

I am looking for some help to solve this question. I cannot figure out how to solve it and the code below is all I have.

Please be advised I am using PostgreSQL. Thus, I must use LANGUAGE PLPGSLQ as that is what the professor is looking for.

Thank you for your help.

Code

CREATE TABLE instructor_course_nums (ID VARCHAR(25), name VARCHAR(25), tot_courses VARCHAR(25));

CREATE TEMPORARY TABLE instructor_course_nums (
ID VARCHAR(5),
name VARCHAR(20),
tot_courses INTEGER
);

CREATE OR REPLACE PROCEDURE Moreno_03_insCourseNumsProc(INOUT i_ID VARCHAR(5))
LANGUAGE PLPGSQL
AS
$$

4. For this problem create a table called instructor_course_nums. Write a procedure that
accepts an instructor ID as input. The procedure calculates the total number of course
sections taught by that instructor, and adds a tuple to the instructor_course_nums table
consisting of the instructors ID number, name, and total courses taught - call these
attributes: ID, name, and tot_courses. If the instructor already has an entry in the table,
then the procedure makes sure the total number of courses taught in the
instructor_course_nums table is up-to-date. You must name your procedure:
<LastName>_<DOB_Day0fMonth>_insCourseNumsProc
Where <LastName> is your last name and <DOB_DayofMonth> is the day of the month
you were born. Below is an example of how I named my procedure:
Morabito 05 inscourseNumsProc
Transcribed Image Text:4. For this problem create a table called instructor_course_nums. Write a procedure that accepts an instructor ID as input. The procedure calculates the total number of course sections taught by that instructor, and adds a tuple to the instructor_course_nums table consisting of the instructors ID number, name, and total courses taught - call these attributes: ID, name, and tot_courses. If the instructor already has an entry in the table, then the procedure makes sure the total number of courses taught in the instructor_course_nums table is up-to-date. You must name your procedure: <LastName>_<DOB_Day0fMonth>_insCourseNumsProc Where <LastName> is your last name and <DOB_DayofMonth> is the day of the month you were born. Below is an example of how I named my procedure: Morabito 05 inscourseNumsProc
Query Editor
Query History
1
CREATE TABLE instructor_course_nums (ID VARCHAR (25), name VARCHAR (25), tot_courses VARCHAR (25));
3
CREATE TEMPORARY TABLE instructor_course_nums (
4
ID
VARCHAR (5),
VARCHAR (20),
name
6.
tot_courses
INTEGER
7
) ;
8.
9
CREATE OR REPLACE PROCEDURE Moreno_03_insCourseNumsProc (INOUT i_ID VARCHAR (5))
10
LANGUAGE PLPGSQL
11
AS
12
$$
13
14
15
16
17
18
19
Data Output
Explain
Messages
Notifications
ERROR:
unterminated dollar-quoted string at or near "$$"
LINE 12:
$$
SQL state: 42601
Character: 454
Transcribed Image Text:Query Editor Query History 1 CREATE TABLE instructor_course_nums (ID VARCHAR (25), name VARCHAR (25), tot_courses VARCHAR (25)); 3 CREATE TEMPORARY TABLE instructor_course_nums ( 4 ID VARCHAR (5), VARCHAR (20), name 6. tot_courses INTEGER 7 ) ; 8. 9 CREATE OR REPLACE PROCEDURE Moreno_03_insCourseNumsProc (INOUT i_ID VARCHAR (5)) 10 LANGUAGE PLPGSQL 11 AS 12 $$ 13 14 15 16 17 18 19 Data Output Explain Messages Notifications ERROR: unterminated dollar-quoted string at or near "$$" LINE 12: $$ SQL state: 42601 Character: 454
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
JQuery and Javascript
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning