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
Information systems security is the collection of activities that protect the information system and the data stored in it.
ivann1987 [24]

Answer:

The answer is A. True.

Explanation:

Information systems security,refers to all the methods involved with assuring information integrity as well as keeping it confidential, and available.

It can also be defined as -

The detection and provisoon of solutions to security breaches.

Access controls, which prevents unauthorized system access.

Protection of information either in transit or in a storage area.

3 0
3 years ago
On a client/server network, data does not necessarily follow the same path between the request (client) and the response (server
Andrej [43]

Answer:

SSL and HTTPS play a factor

6 0
2 years ago
Which of the following is the most abstract?
marysya [2.9K]

D. The word "food" is the most abstract because it is the least specific and does not specify what food it is exactly.

Hope this helps!! :)

4 0
3 years ago
Read 2 more answers
Q) CITY column of a table contains information such as Bangalore , Bangalore-64 , Bangalore-56001 , Mumbai - 400002 etc in order
saw5 [17]
Data splitting:::::::::::)
7 0
3 years ago
The two major types of system software programs are utility programs and the ________. Select one: A. user interface B. supervis
Scrat [10]

Answer:

operating system

Explanation:

System software are those programs that many refer to as computer programs. The most basic function of system software is to manage the computer systems. It acts as an interface between the computer’s hardware and the end user. System software converts instructions that end users give to the computer into a machine understandable language. Examples of system software include operating systems, utility programs, device drivers, and windows systems. The operating system is responsible for the functioning of all the computer’s hardware parts. It is the software loaded into the system when the computer boots up. It manages everything, from the memory, to the CPU, and many other different tasks.

8 0
3 years ago
Other questions:
  • Which company provides the Loki Wi-Fi mapping service?
    10·1 answer
  • In the Remote Access Domain, if private data or confidential data is compromised remotely, you should set automatic blocking for
    5·1 answer
  • Write a complete Java method that returns an integer. The method declares a Scanner object, then prompts the user for a series o
    12·1 answer
  • Write an expression that executes the loop while the user enters a number greater than or equal to 0.
    10·1 answer
  • Gina is driving her car down the street. She has a teddy bear sitting on the back seat. A dog runs in front of Gina's car, so sh
    15·2 answers
  • What is the output of adding 1001011 and 100000?
    7·1 answer
  • Suppose that we are using PDDL to describe facts and actions in a certain world called JUNGLE. In the JUNGLE world there are 4 p
    7·1 answer
  • What is the cell reference for row 22 and column B? __________<br><br> In excel
    5·1 answer
  • Describe the functions of a system software​
    6·2 answers
  • Why can’t I message people? It doesn’t let me, please help.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!