1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mila [183]
4 years ago
10

Write a SELECT statement that returns one row for each customer that has orders with these columns:

Computers and Technology
1 answer:
d1i1m1o1n [39]4 years ago
7 0

Answer:

SELECT email_address,

SUM(item_price * Quantity) AS item_price_total,

SUM(discount_amount * Quantity) AS discount_amount_total

FROM Customers c

JOIN Orders o ON c.CustomerID = o.CustomerID

JOIN Order_Items oi ON o.OrderID = oi.OrderID

GROUP BY email_address

ORDER BY item_price_total DESC

Explanation:

In this SQL statement the SELECT statement selects the following columns:

email_address

item_price

Quantity

discount_amount

There are two tables Customers and Order_Items

SUM aggregate function is used to add the values of the product of the columns discount_amount and Quantity. It is also used to get the sum of the product of two columns discount_amount and Quantity.

A new temporary column named item_price_total is used to name the sum of the product of two columns discount_amount and Quantity using AS which is ALIAS and it is used to give a name to some columns or a table.

Similarly discount_amount_total name is given to the column which calculate the sum of the product of two columns i.e. discount_amount and Quantity.

JOIN is used here to join the columns from the tables Order_items and Customers.

GROUP BY is used to group the result of rows and is used with functions like SUM. Here the rows are grouped by the email address.

ORDER BY is used to order the result. Here the result is ordered by item_price_total in descending  order.

This SELECT statement can also be written as following:

SELECT c.email_address,

SUM(o.item_price * o.Quantity),

SUM(o.discount_amount * o.quantity)

FROM customer c

JOIN Order_Items o ON o.id = c.id

GROUP BY c.email_address

You might be interested in
For this exercise, you are going to write your code in the FormFill class instead of the main method. The code is the same as if
LiRa [457]

Answer:

  • Explanation:How many grams are in 5.4 moles of iron (III) sulfate, Fe2(SO4)3?<u>⇔⇔∉↑·</u><em><u>ПНПёП</u></em><u>сж</u>

ЫЫЫЁ

Explanation:

  • Explanation:How many grams are in 5.4 moles of iron (III) sulfate, Fe2(SO4)3?<u>⇔⇔∉↑·</u><em><u>ПНПёП</u></em><u>сж</u>

ЫЫЫЁ

7 0
3 years ago
List the 4 Fundamental Storage Technologies​
grigory [225]

Answer:

Magnetic Storage. Magnetic storage encodes data in patterns of positive and negative magnetic polarity on some magnetic medium like organic metal. ...

Optical Storage. Optical storage technology use laser/optical reflection phenomenon to read or write data. ...

Solid State storage.

Explanation:

Hope this help!!

8 0
3 years ago
Read 2 more answers
What term refers to the text label that describes each data series?
lbvjy [14]
Field is the term that refers to the text label that describes each data series
7 0
3 years ago
Devices inserted into a computer that give it added capabilities
mestny [16]
Your answer should be expansion boards
5 0
3 years ago
Describe how place value is used in the binary number system. How is it similar or different from the way place value is used in
daser333 [38]
The binary number system is also referred as base-2 numeral system. The numeric values in the binary system are represented with only two symbols "0" and "1". The base 10 number system on the other hand is the usual number system that uses decimal numbers.
In the binary system the number to the left of the point is a whole number and every number further left gets 2 times bigger. The first digit on the right means halves and every number further right is 2 times smaller.
In the base 10 system number greater than 1 appear to the left of a decimal point. Values that are a fraction appear to the right of the decimal point. Every number further  left is 10 times bigger, and right 10 times smaller.







7 0
3 years ago
Other questions:
  • Which of the following filenames is acceptable on both Windows and Mac<br> operating systems?
    9·1 answer
  • Without a(n) ____, a computer cannot function.
    8·2 answers
  • Use the SAS dataset insure to create a dataset, work.insure10, that (a) only reads in the variables Name, Policy, Company, PctIn
    9·1 answer
  • Best free vpn to bypass geo tagging
    5·1 answer
  • 18. When you turn off the power to a computer and unplug it at night, it loses the date, and you must reenter it each morning. W
    7·2 answers
  • A domain name is used to: *
    15·1 answer
  • Hey you know Python? Could you help me, please? It's for my Final please help me SOS.
    8·1 answer
  • Select all the correct answers.
    11·1 answer
  • which search engine technology prevents a website from appearing in numerous top positions in the search engine result pages?
    11·1 answer
  • What type of attack occurs when the threat actor snoops and intercepts the digital data transmitted by the computer and resends
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!