Answered You can buy a ready-made answer or pick a professional tutor to order an original one.

QUESTION

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:

Show more
Elite2
Elite2
  • @
  • 331 orders completed
ANSWER

Tutor has posted answer for $25.00. See answer's preview

$25.00

*** 352 * **** DATABASE ***********

Click here to download attached files: CSC 452 DATABASE PROGRAMMING.docx
or Buy custom answer
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question