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
alexgriva [62]
3 years ago
7

Write a SQL statement to display the WarehouseID, the sum of Quantity On Order, and the sum of QuantityOnHand, grouped by Wareho

useID and Quantity Order. Name the sum of QuantityOnOrder and the sum of QuantityOnHand as TotalItemsOnHand. Use only the INVENTORY table in your SQL statement.
Computers and Technology
1 answer:
mariarad [96]3 years ago
3 0

Answer:

The corrected question is:

Write an SQL statement to display the WarehouseID, the sum of QuantityOnOrder and sum of QuantityOnHand, grouped by WarehouseID and QuantityOnOrder. Name the sum of QuantityOnOrder as TotalItemsOnOrder and the sum of QuantityOnHand as TotalItemsOnHand. Use only the INVENTORY table in your SQL statement.

Answer to this corrected question:

SELECT WarehouseID,

SUM(QuantityOnOrder) AS TotalItemsOnOrder,

SUM(QuantityOnHand) AS TotalItemsOnHand

FROM INVENTORY

GROUP BY WarehouseID, QuantityOnOrder;

According to the given question:

SELECT WarehouseID,

SUM(QuantityOnOrder) + SUM(QuantityOnHand) AS TotalItemsOnHand    

FROM INVENTORY

GROUP BY WarehouseID, QuantityOnOrder;

Explanation:

  • In the SQL statement SELECT statement is used to select the data from the table. Here the SELECT statement is used to select WarehouseID, Sum of the columns QuantityOnOrder and QuantityOnHand from INVENTORY table.
  • The sum of QuantityOnOrder and QuantityOnHand columns are given the name of TotalItemsonHand (In case of the corrected question the sum of column QuantityOnOrder is named as TotalItemsOnOrder and the column QuantityOnHand is named as TotalItemsOnHand ) using Alias AS. Alias is the temporary name given to the columns or table to make them  more readable.
  • GROUP BY statement is used to arrange or "group" same data and is often use with aggregate functions like SUM function here. So the grouping here is done based on two columns WarehouseID and QuantityOnOrder.
  • SUM function in this SQL statement is an aggregate function to calculate the sum of all value in the columns QuantityOnOrder and QuantityOnHand.
You might be interested in
A company has a popular gaming platform running on AWS. The application is sensitive to latency because latency can impact the u
AysviL [449]
Yetwywywywywywyyw would
8 0
2 years ago
Can someone please tell me how to download tor browser onto a Linux laptop?
marta [7]

Answer:

Use windows

Explanation:

7 0
3 years ago
Why is hydrgoen in any group on the periodic table
Radda [10]

Answer:

Hydrogen is placed above group in the periodic table because it has ns1 electron configuration like the alkali metals. However, it varies greatly from the alkali metals as it forms cations (H+) more reluctantly than the other alkali metals. ... Hydrogen has a much smaller electron affinity than the halogens.

8 0
3 years ago
Read 2 more answers
Ellie wants to use Office 2016 for her catering business. For example, she plans to use Word to maintain her collection of recip
Ainat [17]
The answer will be b . Scroll bar
4 0
3 years ago
The average, year after year conditions of temperature, precipitaion,winds and clouds in area is the best description of ?
GarryVolchara [31]

Answer:

The average, year after year, conditions of temperature, precipitation, winds and clouds in an area.

8 0
3 years ago
Other questions:
  • To pinpoint an earthquake's location, scientists need information from how many seismometers?
    8·1 answer
  • What did Muhammad do when he encountered opposition from Mecca’s city leaders? He brought more followers to Mecca. He relocated
    7·2 answers
  • The basic form of backup used in magnetic tape operations is called
    11·1 answer
  • In computers, when the print command is executed, a cable carries this signal from the computer to the printer. In comparing a c
    11·1 answer
  • 9.1.3: Printing vector elements with a for loop. Write a for loop to print all NUM_VALS elements of vector courseGrades, followi
    5·1 answer
  • Which element appears within the top margin of the document but does not form the part of the body of the text?
    15·1 answer
  • What are the different nail disorders?
    13·1 answer
  • What is functionality criteria or alternative word
    8·1 answer
  • 7.
    7·1 answer
  • 8. Choose the 3 correct statements for the code below.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!