Question

Given the scenario of tracking store gift cards that includes these tables:

GIFT CARD CardNo StoreName Value ActivationDate PURCHASE TransactionID Tdate Amt Balance CardNo

GIFT_CARD(CardNo, StoreName, Value, ActivationDate)

PURCHASE(TransactionID, tDate, Amt, Balance,CardNo)

1. Construct the SQL statement to answer this query:

What stores [list name only] have gift cards (no duplicates)?

2. Construct the SQL statement to answer this query:

What stores that offer gift cards have names with ‘mart’ in them?

3. Construct the SQL statement to answer this query:

Which stores have gift cards with values greater than $500 that were activated on Valentine’s Day (02/14/2022)?

4. Construct the SQL statement to answer this query:

What was the amount of the largest purchase made?

5. -Construct the SQL statement to answer this query:

List all information about all gift cards.

6. Construct the SQL statement to answer this query:

List purchases by date in chronological order.

Construct the SQL statement to answer this query:

How many purchases [i.e. purchase transactions] were made on the last day of the year [12/31/2022]?

What stores have total purchase transaction amounts greater than $5000?

-Construct the SQL statement to answer this query:

List the gift card information and remaining balance for all gift cards that have been used to make purchases as well as the gift card information for cards that have not been used (have no purchases).

-Construct the SQL statement to answer this query:

List the name of the store, the original value of the card and the balance of all gift cards that have been used (those with purchase transactions).

-Construct the SQL statement to answer this query:

What was the total amount of purchases made every day (for each date)?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

-- 1) What stores [list name only] have gift cards (no duplicates)?

SELECT DISTINCT(StoreName)

FROM GIFT_CARD;

-- 2) What stores that offer gift cards have names with ‘mart’ in them?

SELECT StoreName

FROM GIFT_CARD

WHERE StoreName LIKE '%mart%';

-- 3) Which stores have gift cards with values greater than $500 that were activated on Valentine’s Day (02/14/2022)?

SELECT StoreName

FROM GIFT_CARD

WHERE Value>=500 AND ActivationDate = '02/14/2022';

--4) What was the amount of the largest purchase made?

SELECT MAX(Amt)

FROM PURACHASE;

--5) List all information about all gift cards.

SELECT *

FROM GIFT_CARD;

--6) List purchases by date in chronological order.

SELECT *

FROM PURCHASE

ORDER BY Tdate;

-- 7) How many purchases [i.e. purchase transactions] were made on the last day of the year [12/31/2022]?

SELECT COUNT(*)

FROM PURCHASE

WHERE Tdate = '12/31/2022';

--8) What stores have total purchase transaction amounts greater than $5000?

SELECT StoreName

FROM GIFT_CARD G, PURCHASE P

WHERE G.CardNo = P.CardNo

GROUP BY G.CardNo, StoreName

HAVING SUM(Amt)>5000;

--9) List the gift card information and remaining balance for all gift cards that have been used to make purchases as well as the gift card information for cards that have not been used (have no purchases).

SELECT G.*, balance

FROM GIFT_CARD G, PURCHASE P

WHERE G.CardNo = P.CardNo;

--10) List the name of the store, the original value of the card and the balance of all gift cards that have been used (those with purchase transactions).

SELECT G.StoreName, G.Value, P.balance

FROM GIFT_CARD G, PURCHASE P

WHERE G.CardNo = P.CardNo;

--11) What was the total amount of purchases made every day (for each date)?

SELECT Tdate, SUM(Amt)

FROM PURCHASE

GROUP BY Tdate;

Add a comment
Know the answer?
Add Answer to:
Given the scenario of tracking store gift cards that includes these tables: GIFT_CARD(CardNo, StoreName, Value, ActivationDate)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A database used for a toy store that keeps track of the inventory and purchase orders...

    A database used for a toy store that keeps track of the inventory and purchase orders from the store. All clients will have their membership ID card to shop. This database will help the store to keep track of their orders. It will also help the store to know how many products are available in the inventory. It is necessary to have a membership to purchase a product. The customer can also bring coupons to get discount. Key attributes: Salesman:...

  • A database used for a toy store that keeps track of the inventory and purchase orders...

    A database used for a toy store that keeps track of the inventory and purchase orders from the store. All clients will have their membership ID card to shop. This database will help the store to keep track of their orders. It will also help the store to know how many products are available in the inventory. It is necessary to have a membership to purchase a product. The customer can also bring coupons to get discount. Key attributes: Salesman:...

  • This is extra information about the shopping database given to answer this question: For many query...

    This is extra information about the shopping database given to answer this question: For many query questions we refer to the following database schema for a website that keeps track of what people like to buy or actually buy in different on-line supermarkets. (Think of something like a cross-store loyalty card system.) customer(cID, cName, street, city) Customers with unique cID and other attributes store(sID, sName, street, city) Stores with a unique ID and other attributes. Stores with the same name...

  • Discount Plus Store is a local discount store with the following​ information: Data Table • October...

    Discount Plus Store is a local discount store with the following​ information: Data Table • October sales are projected to be $390,000. Sales are projected to increase by 10% in November and another 25% in December and then return to the October level in January. 20% of sales are made in cash while the remaining 80% are paid by credit or debit cards. The credit card companies and banks (debit card issuers) charge a 1% transaction fee, and deposit the...

  • Discount Plus Store is a local discount store with the following information: (Click the icon to...

    Discount Plus Store is a local discount store with the following information: (Click the icon to view the information.) Read the requirements. Requirement 1. Prepare the sales budget for November and December. Discount Plus Store Sales Budget For the Months of November and December November December Cash sales Credit sales Total sales f Requirements Prepare the following budgets for November and December: 1. Sales budget 2. Cost of goods sold, inventory, and purchases budget 3. Operating expense budget 4. Budgeted...

  • Many grocery store chains ofer customers a card they can scan when they check out and...

    Many grocery store chains ofer customers a card they can scan when they check out and offer discounts to people whoo so. To get the card, customers must give information, including a mailing address and e-mail address. The actual purpose is not to reward loyal customers but to gather data. What data do these cards allow stores to gather, and why would they want that data? What data do these cards allow stores to gather? Select all that apply A....

  • Interpreting Revenue Recognition for Gift Cards Below are the footnotes to Barnes & Noble Inc.'s 2016...

    Interpreting Revenue Recognition for Gift Cards Below are the footnotes to Barnes & Noble Inc.'s 2016 annual report and membership information obtained from its website. The Barnes & Noble Member Program offers members greater discounts and other benefits for products and services, as well as exclusive offers and promotions via e-mail or direct mail for an annual fee of $25.00, which is non-refundable after the first 30 days. Revenue is recognized over the twelve-month period based upon historical spending patterns...

  • Dollar Plus Store is a local discount store with the following​ information: OctoberOctober sales are projected...

    Dollar Plus Store is a local discount store with the following​ information: OctoberOctober sales are projected to be $ 400 comma 000$400,000. times• Sales are projected to increase by 1010​% in NovemberNovember and another 2020​% in DecemberDecember and then return to the OctoberOctober level in JanuaryJanuary. times• 2525​% of sales are made in cash while the remaining 7575​% are paid by credit or debit cards. The credit card companies and banks​ (debit card​ issuers) charge a 22​% transaction​ fee, and...

  • Exercise 4) Carly's Critters Company operates a gift shop at the local 200. The results of...

    Exercise 4) Carly's Critters Company operates a gift shop at the local 200. The results of operations for the first quarter of 2020 are as follows: $125,000 Sales Cost of Goods Sold (S68.750) S56,250 Gross Margin Selling & Administrative Expenses dministrative Expenses ($12.750) $43.500 Operating Income Income Taxes ($13.920) Net Income $29.580 Additional Information: 1. Assel accounts are cash, accounts receivable; inventory, and equipment (net). Accounts payable is the only liability account. Owner's equity accounts are common stock and retained...

  • Accrual Accounting and Income 100 APPLY YOUR KNOWLEDGE Serial Case LO 3.4 03-77 Learning Objectives 3,...

    Accrual Accounting and Income 100 APPLY YOUR KNOWLEDGE Serial Case LO 3.4 03-77 Learning Objectives 3, 4: Analyse basic financial statement information) Note: This case is part of The Cheesecake Factory serial case contained in every chapter in this The Cheesecake Factory Incorporated (NASDAQ: CAKE) is publicly held and uses U.S. Generally Accepted Accounting Principles (GAAP) to prepare its financial statements. Its fiscal year-end is the 52. 53week period ending on the Tuesday closest to December 31. In 2016, its...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT