Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the information about the database below, write the SQL code to represent each one of the transactions in questions 2 3 . 1 to
Using the information about the database below, write the SQL code to
represent each one of the transactions in questions to
Use BEGIN TRANSACTION and COMMIT TRANSACTION to group the SQL
statements in logical transactions.
ABC Markets sell products to customers. The relational diagram shown in Figure
represents the main entities for ABCs database. Note the following important
characteristics:
A customer may make many purchases, each one represented by an invoice.
The CUSBALANCE is updated with each credit purchase or payment and
represents the amount the customer owes.
The CUSBALANCE is increased with every credit purchase and decreased
with every customer payment.
The date of last purchase CUSDATELSTPUR is updated with each new
purchase made by the customer.
The date of last payment CUSDATELSTPMT is updated with each new
payment made by the customer.
An invoice represents a product purchase by a customer.
An INVOICE can have many invoice LINEs, one for each product purchased.
The INVTOTAL represents the total cost of invoice including taxes.
The INVTERMS can be or representing the number of days
of credit or CASHCHECK or CC
The invoice status can be:
o OPEN when an order is placed
o PAID when payment for an invoice has been received
o CANCEL when an order is placed but is cancelled before payment
is received
A products quantity on hand PQTYOH is updated decreased with each
product sale.
A customer may make many payments. The payment type PMTTYPE 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 PMTDETAILS 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started