SQL REQUEST

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

QUICK SQL REQUEST (beginner level...)

Back at work on Monday morning, the Vice President of Purchasing asks you to help him with the analysis of in-process storage. He asks you to pull information regarding the number of products per storage location.

The result of the query should show:
 - The name of the warehouse (Location)
 - The number of different products per storage location
 - The total quantity of products found at this storage location 
 - The average price of all products found at this storage location

He mentions that for the moment he is only interested in the locations that have more than 50 distinct products because he wants to start inventorying the biggest locations first.

Show the locations in order of smallest to largest number of distinct products.

 

My request is linked to the question but i'm having trouble executing it I would love to know how to do it, thanks in advance.

Quick Launch (Ctrl+Q)
- H2022 TP2.sql - TABLET-LT5IG6DB\SQLEXPRESS.AdventureWorks2019 (TABLET-LT5IG6DB\AHLEM YASMINE (52)) - Microsoft SQL Server Management Studio
Edit
View
Query
Project
Tools
Window
Help
E New Query
品
品中命|2.
MDX'
DMX'
XMLA DAX
ロロ
* AdventureWorks2019
> Execute
bject Explorer
H2022_TP2.sql - T...HLEM YASMINE (52)) + X
=>Question 2
De retour au travail lundi matin, le vice-président des achats vous demande de faire l'aider avec l'analyze de 1'entreposage des produits en cours de production.
Il vous demande de sortir des informations concernant le nombre de produits par localisation d'entreposage.
Le résultat de la requête doit présenter :
- Le nom de l'entreposage (Location)
Le nombre de produits différents par localisation d'entreposage
La quantité totale de produits retrouvés à cette localisation d'entreposage
Le prix moyen de tous les produits retrouvés à cette localisation d'entreposage.
Il vous mentionne que pour l'instant il est interessé uniquement par les localisations qui ont plus de 50 produits distincts car il veut commencer à faire l'inventaires
des plus grosses localisations en premier.
Montrez les localisations par ordre du plus petit au plus grands nombre de produits distincts.
*/
ESELECT Production. Location.Name,
Production.ProductInventory. LocationID,
COUNT (DISTINCT ProductID), SUM (ProductID), AVG (StandardCost) FROM Production.Product
LEFT JOIN Production.ProductInventory ON Production. ProductInventory.ProductID
LEFT JOIN Production.Location ON Production. Location. LocationID
%3D
Production. Product.ProductID
Production. ProductInventory. LocationID;
90 %
BT Messages
Msg 209, Level 16, State 1, Line 99
Ambiguous column name 'ProductID'.
Msg 209, Level 16, State 1, Line 99
Ambiguous column name 'ProductID'.
Completion time: 2022-02-20T17:10:24.0675769-05:00
90 %
Query completed with errors.
TABLET-LT5IG6DB\SQLEXPRESS . TABLET-LT5IG6DB\AHLEM .. AdventureWorks2019 00:00:
OReady
Ln 97
Col 1
Ch 1
INS
Transcribed Image Text:Quick Launch (Ctrl+Q) - H2022 TP2.sql - TABLET-LT5IG6DB\SQLEXPRESS.AdventureWorks2019 (TABLET-LT5IG6DB\AHLEM YASMINE (52)) - Microsoft SQL Server Management Studio Edit View Query Project Tools Window Help E New Query 品 品中命|2. MDX' DMX' XMLA DAX ロロ * AdventureWorks2019 > Execute bject Explorer H2022_TP2.sql - T...HLEM YASMINE (52)) + X =>Question 2 De retour au travail lundi matin, le vice-président des achats vous demande de faire l'aider avec l'analyze de 1'entreposage des produits en cours de production. Il vous demande de sortir des informations concernant le nombre de produits par localisation d'entreposage. Le résultat de la requête doit présenter : - Le nom de l'entreposage (Location) Le nombre de produits différents par localisation d'entreposage La quantité totale de produits retrouvés à cette localisation d'entreposage Le prix moyen de tous les produits retrouvés à cette localisation d'entreposage. Il vous mentionne que pour l'instant il est interessé uniquement par les localisations qui ont plus de 50 produits distincts car il veut commencer à faire l'inventaires des plus grosses localisations en premier. Montrez les localisations par ordre du plus petit au plus grands nombre de produits distincts. */ ESELECT Production. Location.Name, Production.ProductInventory. LocationID, COUNT (DISTINCT ProductID), SUM (ProductID), AVG (StandardCost) FROM Production.Product LEFT JOIN Production.ProductInventory ON Production. ProductInventory.ProductID LEFT JOIN Production.Location ON Production. Location. LocationID %3D Production. Product.ProductID Production. ProductInventory. LocationID; 90 % BT Messages Msg 209, Level 16, State 1, Line 99 Ambiguous column name 'ProductID'. Msg 209, Level 16, State 1, Line 99 Ambiguous column name 'ProductID'. Completion time: 2022-02-20T17:10:24.0675769-05:00 90 % Query completed with errors. TABLET-LT5IG6DB\SQLEXPRESS . TABLET-LT5IG6DB\AHLEM .. AdventureWorks2019 00:00: OReady Ln 97 Col 1 Ch 1 INS
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education