Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CREATE TABLE birthday (B_MONTH NUMBER, B_DAY NUMBER, B_RANK NUMBER); / INSERT INTO birthday SELECT * FROM hchen .birthday; / COMMIT; / SELECT COUNT(*) FROM birthday;

CREATE TABLE birthday

(B_MONTH NUMBER,

B_DAY NUMBER,

B_RANK NUMBER);

/

INSERT INTO birthday

SELECT * FROM hchen.birthday;

/

COMMIT;

/

SELECT COUNT(*) FROM birthday;

/

Write a PL/SQL anonymous block that accepts an integer n (n = 1 or n = 2) from the user input and 1) displays the most popular birthdays along with the ranks for each month if the user input is 1 (n = 1), or 2) displays the least popular birthdays along with the ranks for each month if the user input is 2 (n = 2). Sort your output in ascending order by months.

You will lose 10 points if the title lines are missing in your output.

You will lose 10 points if your output is not in the correct format. For example, you must display the birthdays and ranks for the same month in one line.

Each day-rank pair must be displayed in the DD/RRR format (2-digit day and 3-digit rank) (e.g., 08/012).

You may hard-corded values of months (e.g., FOR idx IN 1..12 LOOP).

If you have hard coded the birthdays or ranks (e.g., DBMS_OUPT.PUT_LINE('1 20/ 240')) in your PL/SQL block, you will receive 0 points.

To avoid complicating issues, you can assume that the user always enters input from keyboard that consists only of the digits 0 through 9 and Enter.

This question can be solved without using cursors.

Submitting more than one PL/SQL program will receive 0 points.

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_2

Step: 3

blur-text-image_3

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

2. Discuss the importance of popular culture as a public forum.

Answered: 1 week ago