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]
3 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]3 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
how many usable host addresses are available for each subnet when 4 bits are borrowed from a class C IP address
jonny [76]

Answer:

The answer is "14".

Explanation:

Let the IP address = 196.45.204.0

When it borrowed 4 bits

\therefore\\\\ subnet = 28

IP=  \frac{196.45.204.0}{28}\\\\ 28 \to 11111111.11111111.11111111.11110000

If the borrowed bits are left out then:

The Number of useable host addresses:

= {(2^4) - 2} \\\\ = 16-2\\\\ =14

3 0
2 years ago
WILL GIVE BRAINLIEST AND 30 POINTS!! NEED ASAP!!!!
kotykmax [81]

Answer:

Explanation:

1. In tabletop games and video games, game mechanics are the rules that guide the player's moves or actions, as well as the game's response to them.

5.User interface is about the visual design and the information designs around the screens while the User Experience is about the whole experience and not only about the screen. User interface is mainly focused on the product while User experience on the other hand mostly focuses on the user and their journey through the product.

5 0
3 years ago
The _____________________ is the measure of how servers are condensed as a result of virtualization.
hodyreva [135]

Answer:

Consolidation ratio

Explanation:

Consolidation ratio within network infrastructure for Internet hosting, is the number of virtual servers that can run on each physical host machine.

5 0
2 years ago
What is common for all machines​
Fed [463]

Answer:

the question is a bit vague, but all machines exist to serve a purpose, or to do or accomplish a certain task.

6 0
3 years ago
Read 2 more answers
What contains the computer's "brain," the central processing unit (CPU).
vodomira [7]

The computer brain is a microprocessor called the central processing unit (CPU). The CPU is a chip containing millions of tiny transistors.

6 0
3 years ago
Other questions:
  • Carmina wants to move a paragraph to the right margin of the document she is working in. She moves her cursor to
    8·2 answers
  • Select all of the uses of presentation software in the workplace.
    8·1 answer
  • Sorting and filtering are two ways to _____ data.
    7·2 answers
  • What default length is used for the ospf dead interval?
    14·1 answer
  • Swapping two numbers
    10·1 answer
  • Readability is the level of vocabulary used on the page. True or false
    8·1 answer
  • Guys Do you know about e-waste recycling well ?
    9·2 answers
  • What is the best programing language to use for building video games?
    10·1 answer
  • The term structure, as it relates to programming, refers to the decisions you make to design your program to best meet its objec
    11·1 answer
  • Write a program that uses a while loop to calculate and print the multiples of 3 from 3 to 21. Your program should print each nu
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!