Question

In: Computer Science

List the statements for the following transaction using the relations below: jsmith orders 1 book with...

List the statements for the following transaction using the relations below: jsmith orders 1 book with ISBN 1045678900 on April 24, 2018.

Note: Bold Represents Primary Key. Italizied attributes in some relations denote foregin keys.

MEMBER(last_name, first_name, email, password, user, street, city, state, zip, card_type, card_no, expiration, name_on_card)

BOOKS_FOR_SALE(listing_no, seller, isbn, condition, price)

ORDERS(order_no, buyer, order_date, total)

ITEMS(order_no, listing_no)

BOOK(isbn, title, author, edition, publisher, keywords)

Solutions

Expert Solution

As the transaction is an Order, We need to insert the record in ORDERS and ITEMS tables. For Insert into ORDERS, We need price of the book which can be retrieved from BOOKS_FOR_SALE table. Also we need listing_no to store in ITEMS which also can be retrieved from BOOKS_FOR_SALE table. For these two we need to create local varaibles and fetch values in these variables.

DECLARE @price DECIMAL(5,2);
DECLARE @listing_no NUMBER(30);

SELECT @listing_no = listing_no, @price = price FROM BOOKS_FOR_SALE
         WHERE isbn = 1045678900 ;

Suppose We are inserting order with Order number as 1. Insert the record in ORDERS as well as ITEMS using above variables.

INSERT INTO ORDERS VALUES(1, '<span data-scaytid="27" data-scayt_word="jsmith">jsmith</span>', to_date('2018-04-24', '<span data-scaytid="28" data-scayt_word="yyyy-mm-dd">yyyy-mm-dd</span>'), @price);

INSERT INTO ITEMS VALUES(1, @listing_no);

Now that we have inserted record in ORDERS, we need to delete the record with isbn = 1045678900 from the BOOKS_FOR_SALE table, as the book is no longer available for sale.
DELETE FROM BOOKS_FOR_SALE WHERE isbn = 1045678900 
OR

DELETE FROM BOOKS_FOR_SALE WHERE listing_no = @listing_no;

These are the complete set of statements for above transaction. Please feel free to ask any questions about this.


Related Solutions

Indicate which of the following relations below are equivalence relations, strict partial orders, (weak) partial orders....
Indicate which of the following relations below are equivalence relations, strict partial orders, (weak) partial orders. If a relation is none of the above, indicate whether it is transitive, symmetric, or asymmetric. I won't be grading proofs of your results here, but I highly suggest you know how to prove your results. The relation ?=?+1 between intgers ?,?. The superset relation ⊇ on the power set of integers. The divides relation on the nonnegative integers ?. The divides relation on...
Using the list provided match the following vendor and expense transaction with the description of the...
Using the list provided match the following vendor and expense transaction with the description of the transaction. I have to match the transactions with the description given. These are the transactions given: Expense Check       Bill       Pay Bills       Purchase Order Vendor Credit Credit Card Credit These are the descriptions given: 1.The form used to select bills we want to pay. 2. The form used to order and track products from vendors. 3. The onscreen form used to record...
For each transaction, (1) analyze the transaction using the accounting equation, (2) record the transaction in...
For each transaction, (1) analyze the transaction using the accounting equation, (2) record the transaction in journal entry form, and (3) post the entry using T-accounts to represent ledger accounts. Use the following (partial) chart of accounts—account numbers in parentheses: Cash (101); Accounts Receivable (106); Office Supplies (124); Trucks (153); Equipment (167); Accounts Payable (201); Unearned Landscaping Revenue (236); D. Tyler, Capital (301); D. Tyler, Withdrawals (302); Landscaping Revenue (403); Wages Expense (601), and Landscaping Expense (696). On May 15,...
For each transaction, (1) analyze the transaction using the accounting equation, (2) record the transaction in...
For each transaction, (1) analyze the transaction using the accounting equation, (2) record the transaction in journal entry form, and (3) post the entry using T-accounts to represent ledger accounts. Use the following (partial) chart of accounts—account numbers in parentheses: Cash (101); Accounts Receivable (106); Office Supplies (124); Trucks (153); Equipment (167); Accounts Payable (201); Unearned Landscaping Revenue (236); Common Stock (307); Dividends (319); Landscaping Revenue (403); Wages Expense (601), and Landscaping Expense (696). On May 15, DeShawn Tyler opens...
For each transaction, (1) analyze the transaction using the accounting equation, (2) record the transaction in...
For each transaction, (1) analyze the transaction using the accounting equation, (2) record the transaction in journal entry form, and (3) post the entry using T-accounts to represent ledger accounts. Use the following (partial) chart of accounts—account numbers in parentheses: Cash (101); Accounts Receivable (106); Office Supplies (124); Trucks (153); Equipment (167); Accounts Payable (201); Unearned Landscaping Revenue (236); D. Tyler, Capital (301); D. Tyler, Withdrawals (302); Landscaping Revenue (403); Wages Expense (601), and Landscaping Expense (696). On May 15,...
32. Which of the following statements is NOT an advantage of a swap transaction? A. It...
32. Which of the following statements is NOT an advantage of a swap transaction? A. It usually allows the company to achieve a lower cost of funds. B. It is used to hedge both interest rate risk and foreign exchange risk. C. It facilitates the restructuring of cash flows associated with existing borrowings. D. It transfers the credit risk to the counterparty. why d is not correct???
1.Which of the following orders instructs the broker to sell at or below a specified price?...
1.Which of the following orders instructs the broker to sell at or below a specified price? Select one: a. Limit-sell order b. Stop-loss c. Limit-buy order d. Stop-buy order e. Market order 2.Hedge funds may invest or engage in Select one: a. distressed firms. b. convertible bonds. c. currency speculation. d. merger arbitrage. e. All of the options are correct. 3.The smallest component of the fixed-income market is _______ debt. Select one: a. Treasury b. other asset-backed c. corporate d....
Create the following SQL queries using the lyrics database below 1. List the first name, last...
Create the following SQL queries using the lyrics database below 1. List the first name, last name, and region of members who do not have an email. 2. List the first name, last name, and region of members who do not have an email and they either have a homephone ending with a 2 or a 3. 3. List the number of track titles that begin with the letter 's' and the average length of these tracks in seconds 4....
Please answer the list of questions below: 1. Discuss the importance of financial statements and how...
Please answer the list of questions below: 1. Discuss the importance of financial statements and how they are used by businesses. 2. What is the basic format of the income statement and what is the relevance of the basic categories? 3. Cash flows for an organization come from operating activities and investment activities. Discuss the importance of each to the organization. 4. The Happy Auto Shop has the following annual information: Gross Sales $700,000 Net sales $696,000 Gross profit $448,000...
1. Using domain and range transformations, solve the following recurrence relations: a) T(1) = 1, T(n)...
1. Using domain and range transformations, solve the following recurrence relations: a) T(1) = 1, T(n) = 2T(n/2) + 6n - 1 b) T(1) = 1, T(n) = 3T(n/2) + n^2 - n
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT