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
The music is the soul who says this
Crazy boy [7]

Question:the music is the soul who says this

Answer: Arthur Schopenhauer

Explanation: he says music is the language of feeling and of passion

question answered by

(jacemorris04)

4 0
3 years ago
‘The increased availability of mobile digital devices has had a positive impact on how young people use their free time’. Make a
Law Incorporation [45]
"The increased availability of mobile digital devices has had a positive impact on how young people use their free time."

There are many different views that you could take upon this subject.  

1) You could say that the increased availability of mobile digital devices has allowed children to increase their academic success, by being able to search for and complete assignments using these devices.

2) You could say that the increased availability of mobile digital devices allows for children to occupy themselves by providing games, videos, books, and other things to provide them with entertainment, a learning experience, and more.

Hope this helps!
4 0
4 years ago
Why would a programmer use this code block?
olasank [31]
C. To select a parameter for a games’s appearance when it starts.
5 0
2 years ago
What is the second row of letters in the keyboard called?
FrozenT [24]
It is called the home row 
4 0
4 years ago
Identify requirements that should be considered when determining the locations and features of firewalls. What are some importan
Karo-lina-s [1.5K]

Answer and Explanation:

The requirements to be considered while determining the firewalls' features and locations are:

  • The reason so as to why to implement a firewall
  • Traffic inspection type required to be accomplished.
  • Best OS, i.e., Operating System suitable for the work need.
  • The method to fir firewall into the topology (network).
  • Making decision whether the firm is more suitable for software solution or application.

Some of the importants steps to be taken for the firewalls to remain effective:-

  • Use of strong password.
  • according to the usage, tweak the settings of the firewall.
  • Enable auto update for firewall.
  • Maintain consistency in settings throughout the network.
  • addition of multiple layers to the security and computer system.
  • Application of encryption (128 bit WEP).
  • Analysis of the traffic both outbound and inbound and taking appropriate measures.
  • Always check for leaks and ports.
8 0
3 years ago
Other questions:
  • Select the correct answer
    8·1 answer
  • What types of data are commonly entered into a cell ?
    7·2 answers
  • Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs, or 45 cents for individual
    6·1 answer
  • AW Computing uses a private sharing model for cases. A select group of five users need read/write access to all cases with a spe
    8·1 answer
  • Arrange the following units of storage in descending<br> order. B, TB,KB, GB,MB
    5·1 answer
  • Which of the following is an example of a syntax error?
    15·1 answer
  • When operating a forklift, what should you do to ensure a clear view and proper balance when traveling with a load?
    6·2 answers
  • Does anyone know how to write this right? This is for a coding class and I’m super confused on it.
    13·1 answer
  • Why does 5G mmWave require more cells to achieve a better signal?
    10·1 answer
  • Declaring a member as ____ in the base class provides access to that member in the derived classes but not to anyone else. a. pu
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!