Assignment | My Assignment Tutor

CSE2DBF 2021Assignment 2 (20%)Due date: 11.59pm (AEST), Sunday, May 30th 2021AIMS 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 thisassignment.Copying, Plagiarism: Plagiarism is the submission of somebody else’s work in a manner that givesthe impression that the work is your own. The Department of Computer Science and InformationTechnology treats plagiarism very seriously. When it is detected, penalties are strictly imposed.Students are referred to the Department of Computer Science and Information Technology’sHandbook and policy documents with regard to plagiarism and assignment return, and also to thesection of ‘Academic Integrity’ on the subject learning guide.No extensions will be given: Penalties are applied to late assignments (5% of total assignment markgiven is deducted per day, accepted up to 5 days after the due date only). If there are circumstancesthat prevent the assignment being submitted on time, an application for special consideration may bemade. See Student Handbook for details. Note that delays caused by computer downtime cannot beaccepted as a valid reason for a late submission without penalty. Students must plan their work toallow for both scheduled and unscheduled downtime.SUBMISSION GUIDELINES:Task 1 should be saved to a file named task1.txt.Task 2 should be saved to a file named task2.txt.Task 3 should be saved to a file named task3.txt.Note: You need to provide the query/procedure/function/trigger execution and the sample output. Forthe trigger, you need to show a sample test that demonstrates the successful execution of the trigger.All the tasks above are to be submitted in soft-copy using the submission link on LMS by11.59pm (AEST), Sunday 30th May 2021. The submission link can be found under“Assignment 2” on the Assessment section of LMS page.SUBMISSION CHECKLIST:✓ The relevant SQL queries for the ‘House2Home Franchise Application’ Database System;✓ The required stored procedures, stored function, and triggers.NOTE: No built-in ORACLE column numbering (such as ROWNUM) or other ORACLEranking facilities (such as RANK) can be used in this assignment.Implement the following tasks.Download the file H2HSchema.sql from the LMS site and run it. This file contains all theCREATE and INSERT statements you will need for this assignment.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_EMPLOYEEFULL_TIME_EMPLOYEE(EmployeeID, WeeklyHours, Salary)(EmployeeID, LeaveDays, Salary, MemberID)TEAM_MEMBERSHAREHOLDER(MemberID)(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 latestduring 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 departmentid and title. Include the departments that have not received any application yet. [6 marks] d.Show the team information and number of members for all successful franchise application.[7 marks] e.Show the details of the franchise application that took the longest time to reach a decision.[8 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 successfulapplication. For each of the members, also include the date on which their franchiseapplication was granted. [9 marks]g. Show the top 4 employees (name, salary earned) that have earned the highest salary fromJanuary 2017 – December 2017. Assume that all casual employees work 12 hours per weekand 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, pleaseinclude both the PL/SQL code and an execute procedure/SQL statement to demonstrate thefunctionality.a. Write a procedure that takes two dates as input (a duration) and updates the commission amountof every weekly report for which the start date falls under this duration. The commission amountis the result of multiplication of sale amount and commission rate (%). The procedure alsogenerates an output in the following format for every affected row:The commission amount for report has been updated to dollars,which is % of the total sale amount of dollars.b. Write a function that takes an employee id and a month-year (date of ‘MON-YYYY’ format) andreturns the total bonus amount the employee have earned by making exceptional sales during thatmonth. 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 andtheir total bonus amount earned for the month of April 2018.Hint: Although we did not maintain referential integrity constraint between EMPLOYEE andWEEKLY_SALES_REPORT, you can safely assume that the employee listed as the bestperforming employee in a sales report is a valid employee, who is present in the employee table.[15 marks each]Task 3 [20 marks]Provide the implementation of the following triggers. For submission, please include both thePL/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 lessthan 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 preservethe data, the trigger stores the deleted report into a backup table:BackupReport (ReportID, StartDate, EndDate, SaleAmount)[10 marks each]

QUALITY: 100% ORIGINAL PAPER – NO PLAGIARISM – CUSTOM PAPER

Leave a Reply

Your email address will not be published. Required fields are marked *