Create and populate the birthday-distribution table

Assignment Help PL-SQL Programming
Reference no: EM131158907

2) CSC 352 and CSC 452-

The BIRTHDAY_DISTRIBUTION table consists of every day of the year, from January 1 to December 31, along with a ranking based on how many babies were born in the United States on that date between 1973 and 1999. Rank 1 is the most popular, rank 2 is the next most popular, and so forth.

Create and populate the BIRTHDAY_DISTRIBUTION table by using the following SQL statements.

CREATE TABLE birthday_distribution
(MONTH NUMBER,
DAY NUMBER,
RANK NUMBER);

INSERT INTO birthday_distribution SELECT * FROM hchen.birthday_distribution;
COMMIT;

SELECT COUNT(*) FROM birthday_distribution;

Please make sure that there are 366 rows in your BIRTHDAY_DISTRIBUTION table.

In the BIRTHDAY_DISTRIBUTION table, you can find that September 16 is the most popular birthday (rank = 1) and February 29 is the least popular birthday (rank = 366). Excluding leap years, December 25 is the least popular birthday (rank = 365).

Begin(2a) CSC 352 only

2a) CSC 352 only

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

• You will lose 10 points if the title lines are missing in your output.
• You will lose 10 points if your output has an incorrect format. For example, you must display the birthdays and ranks for the same month in one line.
• 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)(14/260)')) 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.
• Submitting more than one PL/SQL program will receive 0 points.

Test your program. You must ensure that the output of your program matches the following output (one month per line):

End(2a) CSC 352 only

Begin (2b) CSC 452 only

2b) CSC 452 only

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

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

• You will lose 10 points if your output has an incorrect format.For example, you must display the birthdays and ranks for the same month in one line.

• 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)(14/260)')) 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.

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

Test your program. You must ensure that the output of your program matches the following output (one month per line):

Case 1)

Case 2)

Case 3)

Case 4)

......

End(2b) CSC 452 only

3) CSC 352 and CSC 452-

Begin(3a) CSC 352 only

3a) CSC 352 only

Based on the tables created in Assignment #1, write a PL/SQL program that accepts an employee ID from the user input and displays1) employee name, job, hire date, and his/her department name (If the given employee does not belong to any department, the department name is shown as "------" in your output.), and 2) all employees (alone with their jobs and hire dates) who work in the same department as the given employee andwere hired beforethe given employee (or "NO OUTPUT"). Sort your output by the employee name.

• Hard coding(e.g., IF v_emp_id = 7596 THEN v_1 := ...) will receive 0 points.
• You will lose 10 points if the title lines are missing in your output.
• You will lose 10 points if your output has an incorrect format.
• Submitting more than one PL/SQL program 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.

Test your program. You must ensure that the output of your program matches the following sample output:

Case 1)

Output:

Case 2)

Output:

Case 3)

Output:

Case 4)

Output:

End(3a) CSC 352 only

Begin(3b) CSC 452 only

3b) (CSC 452 only)

Based on the tables created in Assignment #1, write a PL/SQL anonymous block that displays all employees who were hired on the days of the week on which the highest number of employees were hired. The output of the program must contain all the hire dates, employee names, job, their corresponding department names (If an employee does not belong to any department, the department name is shown as "------" in your output.), and the names and salaries of their corresponding managers (If an employee does not have a manager, the manager name and salary are shown as "------" in your output.). Sort your output by days of the week (Monday, Tuesday, ..., Friday) and the hire date.

• You will lose 10 points if the title lines are missing in your output.
• You will lose 10 points if your output has an incorrect format.
• Hard coding (e.g., IF v_day = 'Thursday' OR v_day = 'Friday' OR v_max_num = 4 THEN ...) will receive 0 points.
• Submitting more than one PL/SQL program will receive 0 points.

Hints:

(1) TO_CHAR(hire_date, 'Day')
(2) TRIM(TO_CHAR(hire_date, 'Day'))
(3) TRIM(TO_CHAR(hire_date, 'D')
(4) GROUP BY TO_CHAR(hire_date, 'Day')

The output of your program must match the following:

End(3b) CSC 452 only

Attachment:- SQL_Assignment.rar

Reference no: EM131158907

Questions Cloud

Purchasing cloth from british manufacturers : Who protested by meeting to spin yarn for cloth and avoid purchasing cloth from British manufacturers?
What role should external factors of demand play : What role should external factors of demand play in successful business models?- What is "Business Model Design and Innovation"?
House of burgesses to condemn the stamp act : In History, Who urged the House of Burgesses to condemn the Stamp Act?
Calculate the mass of the sample of silver : Calculate the energy required to raise the temperature of 1.0 mol Ag by 1.0C (called the molar heat capacity of silver).
Create and populate the birthday-distribution table : The BIRTHDAY_DISTRIBUTION table consists of every day of the year, from January 1 to December 31. Create and populate the BIRTHDAY_DISTRIBUTION table by using the following SQL statements.
Describe and explain scenes that apply to the social theme : Explain your interpretation of the meanings of the identified nonverbal communications and symbolism. Summarize how these interpretations are important to the sociological understanding of your chosen social inequality or social class theme.
Philosopher stated that all individuals possessed : "What philosopher stated that all individuals possessed certain ""natural rights""-such as life, liberty, and the pursuit of property?"
Calculate the specific heat capacity and molar heat capacity : Calculate the specific heat capacity and the molar heat capacity of mercury.
Execution of the queen : Why did burke lament the execution of the Queen? What did her death mean for the future of europe?

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Write a select statement that returns two columns

Write a SELECT statement that returns these two columns - CategoryName The CategoryName column from the Categories table

  What is the expected profit for one month

Investigate the profitability that would result if instead of baking 30 batches each morning, they bake 25, 30, 35, or 40 batches. Which would you recommend and why? (You should use Decision Table with Crystal Ball, or Scenario Manager if plain Ex..

  Question 1 calculate the tax on an ordercomplete the

question 1. calculate the tax on an ordercomplete the following steps to create a procedure to calculate the tax on an

  Population of alligators on the kennedy space

In 1970 the population of alligators on the Kennedy Space Center grounds was estimated to be 300. In 1980 the population had grown to an estimated 1500. Using the Malthusian law for population growth, estimate the alligator population on the Kenne..

  Create sql statements for the scenarios

Create SQL statements for the scenarios. Your response should include SQL statement, output and any other assumptions you have made to arrive at the solution.

  Create a database using professional principles

Create a database using professional principles and standards. Use a relational database software application to develop a database implementing the logical design into a physical design.

  Write a pl-sql block

Write a PL/SQ block - Select the average salary of all employees in department number 20.

  Test and compile the sql queries

The Strayer Oracle Server may be used to test and compile the SQL Queries developed for this assignment. Your instructor will provide you with login credentials to a Strayer University maintained Oracle server.

  Create the tables for the project

drop the tables you are creating (in case they've already been created within the schema I'm using).

  Write sql statement which creates stored procedure

Write SQL statement which creates stored procedure with one int input parameter. Stored procedure selects supplierId field and total of all Count field values for each group of supplierId's from Part table.

  Prepare a sql statement to use joining the tables

Write a SELECT statement that joins the Customers, Orders, OrderItems, and Products tables.

  Write statement which creates table named part

Write the statement which creates table named Part, with Id field as an int idendity PK, a SupplierId int field, a Description string field of size 25, a Count int field, a Class string field

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd