Problems resulting from past database modifications

Assignment Help Database Management System
Reference no: EM132931337

DBAS 4002 - BASIC PROGRAMMABILITY & STORED PROCEDURES

Required Databases:

• Chinook

Assignment Instructions:
It is recommended you start with a fresh restore of the Chinook database, to reduce chance of problems resulting from past database modifications.

Create a single .sql script file containing all SQL statements required to meet all requirements listed below.

Assignment Scenario

The Chinook Music Company has identified some problems with their invoicing system. While their current system tracks the amount of money owed per invoice, it does not account for whether an invoice has been paid or not. In addition, invoice payments are occasionally done in installments, so are not fully paid all at once.

They would like to add functionality to their current database that will improve their invoice accounting and track any financial transactions, so they have a record of any payments received against an invoice. This will lead to better accounting practices, less errors, and therefore greater revenue.

The improvements they would like to add should be robust and protected from unexpected errors... nobody likes losing money due to software glitches!

Requirements

Your solution should add the following to the existing Chinook database:
1. A new column called Paid should be added to the existing Invoice table. It will be marked as True only when an invoice has been fully paid. When a new invoice is created, the new field should always be set to False until full payment has been received.
2. A new table called InvoicePayment will be added. See ERD below.
3. Four new procedures should be added to the database.
a. Each procedure must use transactions where appropriate and include basic error handling. If part of the procedure fails, the entirety of its tasks should be reverted.
b. Proc 1: A procedure named uspAddNewInvoice, which will be used to add new invoice records to the Invoice table. Note: For this assignment, an Invoice will only ever have a single InvoiceLine item associated with it. This proc will receive all values for the new Invoice and its line item and add them as new, related records to the Invoice and InvoiceLine tables. The Invoice Date should be auto-generated by the system, and the Invoice Total field should be calculated (Price * Quantity) instead of passed as a parameter.
c. Proc 2: A procedure named uspAddInvoicePayment, which will be used to add a new record to the new InvoicePayment table. Moving forward, this proc will be used to process new payment entries. The Payment Date should be auto-generated by the system.
d. Proc 3: A procedure called uspRunInvoices. The intent of this procedure is to be a one-time proc that will create invoice payment records for all existing records. (Moving forward, Invoices and Payments will use the other new stored procs.) This procedure will assume all existing Invoice have been paid in full. It will go through every existing Invoice record and use data from the existing Invoice records to create new InvoicePayment records. After gathering the appropriate data for an Invoice record, this procedure will call the uspAddInvoicePayment procedure to add the new Payment records.
e. Proc 4: A procedure called uspCheckPaidInvoices, which will iterate through every Invoice record and compare it to its associated Payment record. If the amount in both records is the same, the procedure will update the Paid field in the Invoice table to True.

Executing Procs & Testing Statements
To ensure the accuracy of your work, your script should include executing calls to the new stored procedures, in the proper order, and include any supporting statements that, when run together, ensure all work is completed to the requirements. Note that during tests that add new test records, hard-coded values are acceptable.
Your testing script should include:
• A statement to add a new Invoice/InvoiceLine record (only one InvoiceLine record is required), using your uspAddNewInvoice procedure.
• A statement to add a new invoice payment for the new Invoice added in Test 1, using your uspAddInvoicePayment procedure.
• A statement to revert ALL Invoice records to unpaid status.
• A statement to remove all existing records from the InvoicePayment table.
• A statement to re-create all InvoicePayment records, using your uspRunInvoices procedure.
• A statement to re-set all applicable Invoices to Paid or not, using your uspCheckPaidInvoices procedure.

Attachment:- PROGRAMMABILITY.rar

Reference no: EM132931337

Questions Cloud

How make sure that future decisions are good ones : How make sure that future decisions are good ones and not an escalation of commitment? Be sure to include a discussion of sunk costs versus future costs
Describe the competitive escalation paradigm : Describe the competitive escalation paradigm and how it can be detrimental to financial decisions. What competitive traps are and how to avoid them.
Outline the steps would take as a business manager : Outline the steps you would take as a business manager or owner to minimize the effects of these two factors on decision-making to help ensure
Evaluate the role of the board specific to the organization : Evaluate the role of the board specific to the organization and to the CEO. What issues would you, the CEO, face in your role and in your relationship.
Problems resulting from past database modifications : Problems resulting from past database modifications - Create a single .sql script file containing all SQL statements required to meet all requirements
Outline two potential negotiating tactics : Outline two potential negotiating tactics that you would recommend Sharon Slade use in the negotiation meeting with Alice Jones.
List three qualitative attributes of outdoor sporting goods : List 3 qualitative attributes of outdoor sporting goods that the client may want to ask consumers. Make sure 1 of the qualitative attributes is nominal.
What learned about the impact of economic : What learned about the impact of economic, social, and demographic trends affecting the US labor environment, and how this impacts total reward decisions
Identify the hart city case study were assigned : Identify the Hart City case study you were assigned in the subject line of your post, and choose two presenting challenges that your Hart City service user

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd