代写CSE2DBF作业、代做SQL程序语言作业、database system作业代做、代写SQL课程设计作业

代写CSE2DBF作业、代做SQL程序语言作业、database system作业代做、代写SQL课程设计作业
CSE2DBF 2018
Assignment 2 (20%)
Due date: 11.59pm Friday, Week 5, 19 October
AIMS AND OBJECTIVES:
ü to perform queries on a relational database system using SQL;
ü to demonstrate an advanced knowledge of stored procedures, stored functions and triggers.
This is an individual Assignment. You are not permitted to work as a group when writing this
assignment.
Copying, Plagiarism: Plagiarism is the submission of somebody else’s work in a manner that gives
the impression that the work is your own. The Department of Computer Science and Information
Technology treats plagiarism very seriously. When it is detected, penalties are strictly imposed.
Students are referred to the Department of Computer Science and Information Technology’s
Handbook and policy documents with regard to plagiarism and assignment return, and also to the
section of ‘Academic Integrity’ on the subject learning guide.
No extensions will be given: Penalties are applied to late assignments (5% of total assignment mark
given is deducted per day, accepted up to 5 days after the due date only). If there are circumstances
that prevent the assignment being submitted on time, an application for special consideration may be
made. See Student Handbook for details. Note that delays caused by computer downtime cannot be
accepted as a valid reason for a late submission without penalty. Students must plan their work to
allow for both scheduled and unscheduled downtime.
SUBMISSION GUIDELINES:
All tasks must have proper comments (Tasks as headings) in one single notepad file.
All the tasks above are to be submitted in soft-copy format using the submission link provided
on LMS by 11.59 pm Friday, October 19th, 2018.
SUBMISSION CHECKLIST:
ü The relevant SQL queries for the ‘House2Home Franchise Application’ Database System;
ü The required stored procedures, stored function, and triggers.
Implement the following tasks using SQL Developer
Download the file H2HSchema.sql from the LMS site and run it on SQL Developer. This file
contains all the CREATE and INSERT statements you will need for this assignment.
To run the file, copy paste all codes onto SQL Developer and click on Run Script option to run the
entire set of commands
NOTE: YOU DO NOT NEED TO INSERT MORE DATA INTO THE TABLES.
The list of tables available for this assignment is the following:
STORE (StoreID, StoreAddress, WeekDaysHours, WeekendHours)
ACCOUNT (AccountNo., AccountName, Balance)
DEPARTMENT (DepartmentID, DepartmentTitle, NoOfEmployees, AccountNo,
StoreID, FranchiseTeamID)
WEEKLY_SALES_REPORT (ReportID, StartDate, EndDate, SaleAmount,
ComRate, ComAmount, BrandID, BName, BSaleAmount, TypeID, TName,
TSaleAmount, EmployeeID, Ename, ESaleAmount, EBonus,
DepartmentID)
FRANCHISE_APP (AppNumber, AppDate, DecisionDate, Status,
DepartmentID, TeamID)
EMPLOYEE (EmployeeID, Name, Phone, Email, Address, Gender, DOB,
JoiningDate, CentralOrLocalEmployment, EFTPOSID, CANumber,
DepartmentID)
CASUAL_EMPLOYEE (EmployeeID, HourlyRate)
PART_TIME_EMPLOYEE (EmployeeID, WeeklyHours, Salary)
FULL_TIME_EMPLOYEE (EmployeeID, LeaveDays, Salary, MemberID)
TEAM_MEMBER (MemberID)
SHAREHOLDER (S.H.ID, Name, Phone, Email, Address, NoOfShares,
MemberID)
TEAM (TeamID, TeamName, TeamLeaderID)
MEMBERSHIP (MemberID, TeamID, PercentageOfShare)
NOTE: PK is printed underlined and FK is printed italic in italics.
Task 1 [50 marks]
Using the tables provided above, provide SQL statements for the following queries.
a. Show the store information along with its departments for all stores that opens the latest
during weekend. [5 marks]
b. Show the name and address of all team members for store S001. [5 marks]
c. List the franchise application details for each department of H2H along with the department
id and title. Include the departments that have not received any application yet. [5 marks]
d. Show the team information and number of members for all successful franchise application.
[5 marks]
e. Show the details of the franchise application that took the longest time to reach a decision.
[5 marks]
f. List the team member details (including shareholder and employee details such as id, name,
phone and email) for all the team members who are part of a franchise team of a successful
application. For each of the members, also include the date on which their franchise
application was granted. [5 marks]
g. List the team member details (shareholder/employee details) who has the maximum credit to
his name, based on his percentage of share in the team and the positive account balance of the
franchising department. (Hint: account balance can be found in the Account table)
[10 marks]
h. Show the top 4 employees (name, salary earned) that have earned the highest salary from
January 2017 – December 2017. Assume that all casual employees work 12 hours per week
and there are 45 working weeks a year. [10 marks]
Task 2 [30 marks]
Provide the implementation of the following stored procedures and function. For submission, please
include both the PL/SQL code and an execute procedure/SQL statement to demonstrate the
functionality.
a. Write a procedure that takes two dates as input (a duration) and updates the commission amount
of every weekly report for which the start date falls under this duration. The commission amount
is the result of multiplication of sale amount and commission rate (%). The procedure also
generates an output in the following format for every affected row:
The commission amount for report <ReportID> has been updated to <ComAmount> dollars,
which is <ComRate>% of the total sale amount of <SaleAmount> dollars.
b. Write a procedure that takes an employee id as argument and lists the details of an employee’s
department and reporting boss. Note that an employee’s reporting boss is the person who has the
highest percentage of share in the franchise team. The reporting boss can be either a full-time
employee or a shareholder. If the reporting boss is a shareholder, display number of shares along
with contact details and if the boss is an employee, mention DOB, gender and joining date along
with the contact information.
c. Write a function that takes an employee id and a month-year (date of ‘MON-YYYY’ format) and
returns the total bonus amount the employee have earned by making exceptional sales during that
month. If the employee was not awarded a bonus for that month, the function should return zero.
For the execution of the function, write a simple SQL query that lists down all the employees and
their total bonus amount earned for the month of April 2018.
Hint: Although we did not maintain referential integrity constraint between EMPLOYEE and
WEEKLY_SALES_REPORT, you can safely assume that the employee listed as the best
performing employee in a sales report is a valid employee, who is present in the employee table.
[10 marks each]
Task 3 [20 marks]
Provide the implementation of the following triggers. For submission, please include both the
PL/SQL code and a DML statement (insert, update or delete) to demonstrate the trigger functionality.
a. A trigger that prevents a full-time employee from applying for a franchise if he/she has less
than 10 years of experience as an employee of H2H.
b. A trigger that automatically backs-up a weekly sales report when it is deleted. To preserve
the data, the trigger stores the deleted report into a backup table:
BackupReport (ReportID, StartDate, EndDate, SaleAmount)
[10 marks each]

http://www.daixie0.com/contents/15/1887.html

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:[email protected] 

微信:codinghelp

猜你喜欢

转载自www.cnblogs.com/mylovepython/p/9822634.html