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 System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education