Home » CSC 352 / 452: DATABASE PROGRAMMING

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:

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
Live Chat+1 763 309 4299EmailWhatsApp

We Can Handle your Online Class from as low as$100 per week