CSC 352 / 452: DATABASE PROGRAMMING

CSC 352 / 452: Database Programming

assignment #1 (60 Points)

Due on Tuesday, 1/12/2016 at 11:59PM

Unless prior arrangements are made, homework turned in late but within 24 hours of the due time will be graded at 75% credit, homework turned in between 24 and 48 hours will be graded at 50% credit, and homework turned in later than 48 hours will not be accepted.

Part II(60 points)

Your SQL statements can only reference the DEPARTMENTtable and/or EMPLOYEE table. You are not allowed to create/access other tables/views.

1)  (CSC 352 – 20 points | CSC 452 – 10 points)

Write a SQL SELECT statement to display all jobs,the maximum salary for each job, the maximumtotal pay (salary + commission) for each job, and the total number of employees in each job. You must display the maximumsalary and total pay with a dollar ($) sign, a comma, and two decimal places (e.g., $1,234.56).(You will lose 5 points if you fail to do so.) Sort your outputin ascending orderby job. (Submitting more than one SQL statement will receive 0 points.)Your statement’s output should match the following format:

JOB                                                MAXIMUM SALARY MAXIMUM TOTAL PAY TOTAL NUMBER OF EMPLOYEES

————————————————– ————– —————– ————————-

ANALYST                                            $3,000.00      $3,000.00                                 3

2)  (CSC 352 – 20 points | CSC 452 – 10 points)

Write a SQL SELECT statement to displayemployee ID, name, job, and hire date for all employees along with their managers’ namesand hire dates.Make sure that employees without managers are included as well. If an employee does not have a manager, the manager’s name is shown as “——” and the manager’s hire date is shown as 01-JAN-3000in your output. The hire date must be displayed in the DD-MON-YYYY format (4-digit year). Sort your outputin ascending order by employee name.(Submitting more than one SQL statement will receive 0 points.)

Hints:          1) You may need to use an OUTER JOINand aSELF-JOIN.

    2) NVL(TO_CHAR(column_x, ‘DD-MON-YYYY’), ’01-JAN-3000′)

You cannot use hard-coded employee names (e.g., WHERE employee_name = ‘KING’) in your programs.

Your statement’s output should match the following format:

EMPLOYEE ID EMPLOYEE NAME        EMPLOYEE JOB                                       EMPLOYEE HIRE DATE MANAGER NAME         MANAGER HIRE DATE

———– ——————– ————————————————– —————— ——————– —————–

       7876 ADAMS                PROGRAMMER                                         15-JAN-2003        SMITH                20-DEC-2001      

       8000 BREWSTER             TBA                                                22-AUG-2013        ——               01-JAN-3000

……      

3)  (CSC 352 – 20 points | CSC 452 – 20 points)

Write aSQL SELECT statement to find out the most recently hired employees in each department.YourSELECT statement must display the department ID, department name, employee ID, employee name, job, and hire date.Any employeewho does not belong to any department is excluded from your output.Sort your outputin ascending order by department name and then employee name. (Submitting more than one SQL statement will receive 0 points.)

Hint:  A subquery may be needed in your SELECT statement.

Your statement’s output should match the following format:

DEPARTMENT ID DEPARTMENT NAME      EMPLOYEE ID EMPLOYEE NAME        JOB                                                HIRE_DATE

————- ——————– ———– ——————– ————————————————– ———

           10 ACCOUNTING                  7886 STEEL                PUBLIC ACCOUNTANT                                  08-MAR-03

……

4)  (CSC 452 only – 20 points)

Write a SQL SELECT statement to displaythe name and address of all departments(except the departments in Dallas) having maximum number of employees.Sort your output in ascending order by department name.  (Submitting more than one SQL statement will receive 0 points.)

Hard coding, except the string ‘DALLAS’, is not allowed in your program.

Hints:          Subqueries should be used. No join operation is needed.

DEPARTMENT NAME

ADDRESS

NUMBER OF EMPLOYEES

ACCOUNTING

NEW YORK

2

EXECUTIVE

NEW YORK

3

IT

DALLAS

4

MARKETING

CHICAGO

0

RESEARCH

DALLAS

3

SALES

CHICAGO

3

Your statement’s output should match the following format:

DEPARTMENT_NAME      ADDRESS           

——————– ——————–

EXECUTIVE            NEW YORK            

……

Please submit a text file(your_name_hw1.txt) containing all the source codes (Part II) to D2L before or on due date.

Example: your_name_hw1.txt

================

Part II

================

1)

SELECT … FROM…;

2)

SELECT … FROM …;

……

Optional Question

Just for fun (no credit, no extra credit, no need to submit, just for if you are a curious person and like database programming).

CREATE TABLE t1

(

    ENAME        VARCHAR2(10),

    SALARY   NUMBER(7, 2)

);

/

INSERT INTO t1VALUES(‘BLAKE’,      2850.90);

INSERT INTO t1VALUES(‘CLARK’,      2499.00);

INSERT INTO t1VALUES(‘KING’,  5049.25);

INSERT INTO t1VALUES(‘MILLER’,     0.0);

INSERT INTO t1VALUES(‘SMITH’, NULL);

COMMIT;

Writea SQL SELECT statement to convert numbers to their words equivalent.

SELECT   …

FROM         t1

ORDER BY     ename;

The output of your statementmust match the following:

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with MyStudyWriters
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
10th grade English
very good
Customer 452773, March 26th, 2023
History
Looks great and appreciate the help.
Customer 452675, April 26th, 2021
Business and administrative studies
perfect
Customer 452773, February 23rd, 2023
Human Resources Management (HRM)
excellent
Customer 452773, June 25th, 2023
Human Resources Management (HRM)
excellent job
Customer 452773, July 17th, 2023
Human Resources Management (HRM)
excellent job
Customer 452773, June 25th, 2023
Nursing
I just need some minor alterations. Thanks.
Customer 452547, February 10th, 2021
FIN571
excellent
Customer 452773, March 15th, 2024
Leadership Studies
excellent job as always
Customer 452773, September 2nd, 2023
Criminal Justice
The paper was not accused of plagiarism and was written very well. I will let you know the grade once it is graded. Thank you
Customer 452671, April 26th, 2021
fin571
EXCELLEN T
Customer 452773, March 21st, 2024
Leadership Studies
awesome work as always
Customer 452773, August 19th, 2023
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
OUR GIFT TO YOU
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat
Close

Sometimes it is hard to do all the work on your own

Let us help you get a good grade on your paper. Get professional help and free up your time for more important courses. Let us handle your;

  • Dissertations and Thesis
  • Essays
  • All Assignments

  • Research papers
  • Terms Papers
  • Online Classes
Live ChatWhatsApp