Write the sql code to represent each of given transactions

Assignment Help PL-SQL Programming
Reference no: EM131734385

Assignemnt: "Database Transactions"

ABC Markets sell products to customers. The relational schema shown below represents the main entities for ABC's database. Note the following important characteristics:

• A customer can make many purchases, each one represented by an invoice.

o The CUS_BALANCE is updated with each credit purchase or payment and represents the amount the customer owes.
o The CUS_BALANCE is increased (+) with every credit purchase and decreased (-) with every customer payment.
o The date of last purchase is updated with each new purchase made by the customer.
o The date of last payment is updated with each new payment made by the customer.

• An invoice represents a product purchase by a customer.

o An INVOICE can have many invoice LINEs, one for each product purchased.
o The INV_TOTAL represents the total cost of invoice including taxes.
o The INV_TERMS can be "30", "60" or "90" (representing the number of days of credit), or "CASH", "CHECK" or "CC".
o The invoice status can be "OPEN", "PAID", or "CANCEL".

• A product's quantity on hand (P_QTYOH) is updated (decreased) with each product sale.

• A customer can make many payments. The payment type (PMT_TYPE) can be one of the following:

o "CASH" for cash payments.
o "CHECK" for check payments.
o "CC" for credit card payments.

• The payment details (PMT_DETAILS) are used to record data about check or credit card payments:

o The bank, account number, and check number for check payments.
o The issuer, credit card number, and expiration date for credit card payments.

Note: Not all entities and attributes are represented in this example. Use only the attributes indicated.

The ABC Markets Relational Schema

1051_Markets-Relational-Schema.jpg

Using this database, write the SQL code to represent each one of the following transactions. Use BEGIN TRANSACTION and COMMIT to group the SQL statements in logical transactions.

1. On May 11, 2006, customer 10010 makes a credit purchase (30 days) of one unit of product 11QER/31 with a unit price of $110.00; the tax rate is 8%. The invoice number is 10983, and this invoice has only one product line.

2. On June 3, 2006, customer 10010 makes a payment of $100 in cash. The payment ID is 3428.

3. Create a simple transaction log (using the same format as that in the case assignment) to represent the actions of the two previous transactions.

Note: The "before" values in the transaction can be assumed. The "after" value must be computed using the assumed "before" value, plus or minus the transaction value. Also, in order to save some space, you can combine the "after" values for the INSERT statements into a single cell. Actually, each value could be entered in individual rows.

Reference no: EM131734385

Questions Cloud

Demonstrate sufficient preparation : Demonstrate sufficient preparation and include an introduction with an appropriate and explicitly stated thesis staement.
Investor owns some stock in? harry pottery : The stock recently underwent a 55?-for-44 stock split. If the stock was trading at ?$52.19 per share just before the? split, how much is each share
Difference between the lr and the ltv : What is the difference between the leverage ratio (LR) and the loan-to-value ratio (LTV)? How much greater property value can be purchased with a 75% LTV.
Corporate strategy-diversification and vertical integration : Does Google employ any of the following three elements of corporate strategy: diversification, vertical integration, or globalization?
Write the sql code to represent each of given transactions : write the SQL code to represent each one of the following transactions. Use BEGIN TRANSACTION and COMMIT to group the SQL statements in logical transactions.
Analyze the corporate strategy of google : Analyze the corporate strategy of Google, including product, geographical, and vertical scope in which it operates.
Analyze google business model : Explain the generic business strategies, including cost, differentiation, and focus or hybrid information for Google. Analyze Google business model.
Profit-maximizing quantity of dvds that john should produce : Suppose the price of a DVD is $7. What is the profit-maximizing quantity of DVDs that John should produce? What will his total profit be?
Discuss how maritza can most effectively determine : Discuss how Maritza can most effectively determine if her clients are truly satisfied with her program? Be specific.

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write pl-sql procedures and functions

Write PL/SQL procedures and functions to populate and query that database

  Sql questions

Write a query to display using the employees table the EMPLOYEE_ID, FIRST_NAME, LAST_NAME and HIRE_DATE of every employee who was hired after to 1 January, 1995.

  Run the lab_03_01.sql script

Run the lab_03_01.sql script in the attached file to create the SAL_HISTORY table. Display the structure of the SAL_HISTORY table.

  Write sql queries

Write a query to display the last name, department number, and salary of any employee whose department number and salary both match the department number and salary of any employee who earns a commission.

  Explaining sql insert statement to insert new row in cds

Write down a SQL insert statement to insert new row in "CDS" table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Determine resonant frequency in series rlc resonant circuit

Given the series RLC resonant circuit in the figure, operating at variable frequency, determine: The resonant frequency ω o ,  The circuit’s quality factor Q , The cut-off frequencies, f 1  & f 2  and the bandwidth BW

  Query that uses cube operator to return lineitemsum

Write summary query which uses CUBE operator to return LineItemSum (which is the sum of InvoiceLineItemAmount) group by Account(an alias for AccountDesciption).

  Query to show customers were missing for existing orders

As DBA, your manager called a meeting and asked why there are so many orders for customers that don't exist in the customer table. Write query which would shows which customers were missing for existing orders. Use a join or a subquery.

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

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