Question
Considering this tables in SQL CREATE TABLE department ( DEPARTMENT_ID NUMBER(4) PRIMARY KEY, DEPARTMENT_NAME VARCHAR2(20) NOT NULL UNIQUE, LOCATION VARCHAR2(20) NOT NULL); INSERT INTO department
Considering this tables in SQL
CREATE TABLE department ( DEPARTMENT_ID NUMBER(4) PRIMARY KEY, DEPARTMENT_NAME VARCHAR2(20) NOT NULL UNIQUE, LOCATION VARCHAR2(20) NOT NULL);
INSERT INTO department VALUES(10, 'ACCOUNTING', 'NEW YORK'); INSERT INTO department VALUES(20, 'RESEARCH', 'DALLAS'); INSERT INTO department VALUES(30, 'SALES', 'CHICAGO'); INSERT INTO department VALUES(40, 'IT', 'DALLAS'); INSERT INTO department VALUES(50, 'EXECUTIVE', 'NEW YORK'); INSERT INTO department VALUES(60, 'MARKETING', 'CHICAGO'); COMMIT;
CREATE TABLE employee ( EMPLOYEE_ID NUMBER(4) PRIMARY KEY, EMPLOYEE_NAME VARCHAR2(20) NOT NULL, JOB_TITLE VARCHAR2(50) NOT NULL, MANAGER_ID NUMBER(4) REFERENCES employee(EMPLOYEE_ID) ON DELETE SET NULL, HIRE_DATE DATE NOT NULL, SALARY NUMBER(9, 2) NOT NULL, COMMISSION NUMBER(9, 2), DEPARTMENT_ID NUMBER(4) REFERENCES department(DEPARTMENT_ID));
INSERT INTO employee VALUES(7839, 'KING', 'PRESIDENT', NULL, '20-NOV-01', 5000, NULL, 50); INSERT INTO employee VALUES(7596, 'JOST', 'VICE PRESIDENT', 7839, '04-MAY-01', 4500, NULL, 50); INSERT INTO employee VALUES(7603, 'CLARK', 'VICE PRESIDENT', 7839, '12-JUN-01', 4000, NULL, 50);
INSERT INTO employee VALUES(7566, 'JONES', 'CHIEF ACCOUNTANT', 7596, '05-APR-01', 3000, NULL, 10); INSERT INTO employee VALUES(7886, 'STEEL', 'PUBLIC ACCOUNTANT', 7566, '08-MAR-03', 2500, NULL, 10); INSERT INTO employee VALUES(7610, 'WILSON', 'BUSINESS ANALYST', 7596, '03-DEC-01', 3000, NULL, 20); INSERT INTO employee VALUES(7999, 'WOLFE', 'TEST ANALYST', 7610, '15-FEB-02', 2500, NULL, 20); INSERT INTO employee VALUES(7944, 'LEE', 'REPORTING ANALYST', 7610, '04-SEP-06', 2400, NULL, 20);
1)
Based on the EMPLOYEE table created in Assignment #1, write a PL/SQL anonymous block that displays the number of employees earned salaries in each of the following ranges: $0.00 - $499.99, $500.00 - $999.99, $1000.00 - $1499.99, , $9500.00 - $9999.99. You can only use ONE SELECT-INTO statement in your program.
You will lose 10 points if more than ONE SELECT-INTO statement is used.
Using more than FIVE local variables will lose 10 points.
Oracle collection is not allowed.
For example, if you use v_sal := sal_range (500.00,1000.00,1500.00,,10000.00), you will receive 0 points.
Submitting more than one PL/SQL program will receive 0 points.
Hint: FOR idx IN 0..19 LOOP SELECT INTO FROM ; END LOOP;
Creating cleanly formatted output is a common programming requirement. The format of your output must match mine EXACTLY. If your output does not match mine EXACTLY, you will lose some points.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started