Answered step by step
Verified Expert Solution
Link Copied!

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 23.1 to 23.2.
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
1 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 CUS_BALANCE is updated with each credit purchase or payment and
represents the amount the customer owes.
The CUS_BALANCE is increased (+) with every credit purchase and decreased
(-) with every customer payment.
The date of last purchase (CUS_DATELSTPUR) is updated with each new
purchase made by the customer.
The date of last payment (CUS_DATELSTPMT) 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 INV_TOTAL represents the total cost of invoice including taxes.
The INV_TERMS can be 30,60, or 90(representing the number of days
of credit) or CASH,CHECK, 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 (P_QTYOH) is updated (decreased) with each
product sale.
A customer may 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

Students also viewed these Databases questions

Question

What is the purpose of a code of conduct?

Answered: 1 week ago

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago

Question

What is sociology and its nature ?

Answered: 1 week ago

Question

What is liquidation ?

Answered: 1 week ago

Question

Explain the different types of Mergers.

Answered: 1 week ago