Answer the question
In order to leave comments, you need to log in
Why is the request value not correct?
I am going through a task on a well-known site:
Source tables:
Product(maker, model, type)
PC(code, model, speed, ram, hd, cd, price)
Laptop(code, model, speed, ram, hd, price, screen)
Printer(code, model, color, type, price)
Task itself:
Find the average price of PCs and PC notebooks produced by manufacturer A (Latin letter). Output: one total average price.
Here is my request
SELECT
SUM(Price)/SUM(Kol)
FROM
(SELECT
Price,
COUNT(PC.Code) as kol
FROM PC,Product
Where Pc.Model = Product.Model and Product.Maker = 'A'
GROUP BY PRICE
UNION ALL
SELECT
Price,
COUNT(Laptop.Code) as kol
FROM Laptop,Product
Where Laptop.Model = Product.Model and Product.Maker = 'A'
GROUP BY PRICE) as X
Answer the question
In order to leave comments, you need to log in
And fuck such requests. I understand what an assignment is, but in a real project? What for? It is possible to calculate everything on the server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question