Question: #7920

MIS562 Week 7 Assignment Complete Solution

Name:    _______________________
Homework (100 points)  
For Part 1 Q1, you don’t need to run SQL and no output is required.
For Part 1 Q2, be sure to include output
For part 2 running stored procedure, please refer to document under Announcement. You must include output for all three questions

Part 1

Question     SQL statement or Answer
1.    Analyze the following query and write a description of the output it produces. (20 points)
Do not run query.
    Determine the total capacity for courses and display courses with the capacity of 20 or less, between 21 and 30 and over 31 in three columns.
The results show there are two courses capacity is below 20, 10 between 21 and 30 and 16 over 31.

SELECT COUNT(DECODE(SIGN(total_capacity-20), -1, 1, 0, 1)) "<=20",
    COUNT(DECODE(SIGN(total_capacity-21), 0, 1, -1, NULL,
    DECODE(SIGN(total_capacity-30), -1, 1)))"21-30",
    COUNT(DECODE(SIGN(total_capacity-30), 1, 1)) "31+"
    FROM
        (SELECT SUM(capacity) total_capacity, course_no
             FROM section
             GROUP BY course_no)


You don’t need to execute SQL Query and you are not required to provide executed output
2.    Determine the top three highest salary from department 10, 20 and 30 (20 points)
    


Part 2
Write a stored procedure using the student schema: submit the output with your answer (20 points)
Write a stored function using the student schema: submit the output with your answer (20 points)
Write a trigger using the student schema: submit the output with your answer (20 points)

Solution: #7915

MIS562 Week 7 Assignment Complete Solution

CREATE PROCEDURE student (IN z...
Tutormaster
Rating: A+ Purchased: 11 x Posted By: Vikas
Comments
Posted by: Vikas

Online Users