Question: SQL: Create the prerequisite table using the following: CREATE TABLE top_salaries (salary NUMBER(8,2) ); then proceed to the question attached below: 3. Before this question

SQL:

Create the prerequisite table using the following:

CREATE TABLE top_salaries

(salary NUMBER(8,2)

);

then proceed to the question attached below:

SQL: Create the prerequisite table using the following: CREATE TABLE top_salaries (salary

3. Before this question please execute script in your Assigment1 folder name lab 07_01.sql to create required table. Create a PL/SQL block that determines the top n salaries of the employees. a. Execute the lab_07_01.sql script to create a new table, top_salaries, for storing the salaries of the employees In the declarative section, declare a variable v num of type NUMBER that holds a number n representing the number of top n earners from the employees table. For example, to view the top five salaries, enter 5. Declare another variable sal of type e sor, c emp cursor, that retrieves the salaries b. mployees.salary. Declare a cur of employees in descending order. In the executable section, open the loop and fetch top n salaries and insert them into top_salaries table. You can use a simple loop to operate on the data. Also, try and use %ROWCOUNT and % FOUND attributes for the exit condition Note: Make sure you add an exit condition to avoid having an infinite loop. c. d. After inserting into the top_salaries table, display the rows with a SELECT statement. The output shown represents the five highest salaries in the employees table. SALARY 24000 17000 3. Before this question please execute script in your Assigment1 folder name lab 07_01.sql to create required table. Create a PL/SQL block that determines the top n salaries of the employees. a. Execute the lab_07_01.sql script to create a new table, top_salaries, for storing the salaries of the employees In the declarative section, declare a variable v num of type NUMBER that holds a number n representing the number of top n earners from the employees table. For example, to view the top five salaries, enter 5. Declare another variable sal of type e sor, c emp cursor, that retrieves the salaries b. mployees.salary. Declare a cur of employees in descending order. In the executable section, open the loop and fetch top n salaries and insert them into top_salaries table. You can use a simple loop to operate on the data. Also, try and use %ROWCOUNT and % FOUND attributes for the exit condition Note: Make sure you add an exit condition to avoid having an infinite loop. c. d. After inserting into the top_salaries table, display the rows with a SELECT statement. The output shown represents the five highest salaries in the employees table. SALARY 24000 17000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!