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
Most IT security threats originate with hackers.<br> Question 3 options:<br> True<br> False
kap26 [50]
The answer is True they do originate with hackers
6 0
3 years ago
Which case would benefit from Explainable Artificial Intelligence (AI) principles?
Nadya [2.5K]

The case that will benefit from Explainable Artificial Intelligence (AI) principles is a doctor who depends on AI to make diagnosis.

Using Explainable Artificial Intelligence principles of supported evidence, understandable and accurate explanations, and knowledge limit as designed for AI, will save the doctor and all medical staff enormous amount of time.

Explainable Artificial Intelligence enables all medical staff to focus on correct medical interpretation and treatment instead of wasting time on repetitive medical tasks.

In comparison, the medical doctor will benefit more than a music streaming platform recommending a song, a navigation platform suggesting fastest routes, or a social media platform that identifies faces from a picture.

Thus, a medical doctor will find Explainable Artificial Intelligence principles useful to reduce some of the repetitive tasks that she undertakes, thereby focusing her attention on providing appropriate medical care to the patients.

Learn more about Explainable Artificial Intelligence here: brainly.com/question/22650312

5 0
2 years ago
Read 2 more answers
Suppose you define a java class as follows: public class test { } in order to compile this program, the source code should be st
likoan [24]
Test.java

The classname and the filename need to match (case sensitive).
5 0
2 years ago
a new client has indicated that they are exercising due to advice from their physician, but they are generally amotivated. what
Orlov [11]

The factor that is a best choice for the personal trainer in their initial meeting is option a: Inquire further about what their motives are for participating.

<h3>What are the motives in motivation?</h3>

Psychologists is known to have shared motives into three types which are:

  • Biological motives
  • Social motives
  • Personal motives.

Note that the goal that is to be meant is for the fulfillment of  the client want or their  need.

Therefore asking the right question will go a long way in satisfying them. So, The factor that is a best choice for the personal trainer in their initial meeting is option a: Inquire further about what their motives are for participating.

Learn more about personal trainer from

brainly.com/question/19462080
#SPJ1

A new client has indicated that they are exercising due to advice from their physician, but they are generally amotivated. What would be the best choice for the personal trainer in their initial meeting?

Inquire further about what their motives are for participating.

Create a plan for overcoming barriers.

Establish short- and long-term goals.

Start establishing an emotional support system.

5 0
1 year ago
At the second simple query wizard dialog box, you are asked whether you would like to create a detail or a(n) _____ query.
Alisiya [41]
The correct answer is: Summary

<span>If you only selected fields from a single table in the first screen, then when you click the “Next >” button to continue, you will only need to provide the query with a name and then click the “Finish” button to finish creating the query. If, however, you picked data fields from two or more related tables, then when you click the “Next >” button, you will instead view a second screen which asks if you would like a “Detail” or “Summary” query. You can select the option button for the type of query that you wish to create. If you select “Summary,” then you will be able to click the “Summary Options…” button to open the “Summary Options” dialog box. In this dialog box, you can select what type of summary to perform over a selected field. Make your selections, and then click the “OK” button to return to the “Simple Query Wizard.”</span>

Select summary to show only results of aggregate functions.

Select the aggregate function and the field name of the numeric field in the list box. You can enter as many aggregate functions as you want, one in each row of controls.

Aggregate function

Select the aggregate function.

Field name

Select the numeric field name.

+

Appends a new row of controls.

-

Removes the last row of controls.

3 0
2 years ago
Other questions:
  • An electronic resume is a plain-looking document. True of False?
    6·2 answers
  • loop Write a program to read a list of exam scores given as integer percentages in the range 0 to 100. Display the total number
    5·1 answer
  • You can leave out the ____ statements in a switch structure.
    15·1 answer
  • You friends parents are worried about going over their budget for the month. Which expense would you suggest is NOT a need?
    10·1 answer
  • Write a program that reads in an integer value for n and then sums the integers from n to 2 * n if n is nonnegative, or from 2 *
    5·1 answer
  • A is a paid placement that appears in a search engines results page at or near the top of the results
    5·1 answer
  • Disadvantages of Batch<br>operation system​
    5·1 answer
  • Write a program that will sort an array of data using the following guidelines - DO NOT USE VECTORS, COLLECTIONS, SETS or any ot
    10·1 answer
  • Who Likes K-pop? Which group or groups do you like
    12·2 answers
  • বর্তমান করােনার ন্যায় পরিস্থিতি অর্থাৎ স্বাভাবিক শ্রেণি কার্যক্রম পরিচালনা সম্ভব
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!