Ishdan maqsad: Agregat funksiyailardan foydalanish bo`yicha ko`nikmaga EGA bo`lish. Masalani qo`yilishi


Download 20.67 Kb.
bet2/3
Sana03.02.2023
Hajmi20.67 Kb.
#1156000
1   2   3
Bog'liq
12-laboratoriya

('Honor 10', 'Huawei', 5, 28000),
('Nokia 8', 'HMD Global', 6, 38000);
Query OK, 7 rows affected (0.17 sec)
Records: 7 Duplicates: 0 Warnings: 0

mysql> SELECT * FROM PRODUCTS;
+----+-------------+--------------+--------------+-------+
| Id | ProductName | Manufacturer | ProductCount | Price |
+----+-------------+--------------+--------------+-------+
| 1 | iPhone X | Apple | 3 | 76000 |
| 2 | iPhone 8 | Apple | 2 | 51000 |
| 3 | iPhone 7 | Apple | 5 | 32000 |
| 4 | Galaxy S9 | Samsung | 2 | 56000 |
| 5 | Galaxy S8 | Samsung | 1 | 46000 |
| 6 | Honor 10 | Huawei | 5 | 28000 |
| 7 | Nokia 8 | HMD Global | 6 | 38000 |
+----+-------------+--------------+--------------+-------+
7 rows in set (0.00 sec)

mysql> SELECT AVG(Price) AS Average_Price FROM Products;
+---------------+
| Average_Price |
+---------------+
| 46714.2857 |
+---------------+
1 row in set (0.10 sec)

mysql> SELECT AVG(Price) FROM Products
WHERE Manufacturer='Apple';
+------------+
| AVG(Price) |
+------------+
| 53000.0000 |
+------------+
1 row in set (0.00 sec)

mysql> SELECT AVG(Price * ProductCount) FROM Products
;
+---------------------------+
| AVG(Price * ProductCount) |
+---------------------------+
| 145142.8571 |
+---------------------------+

Download 20.67 Kb.

Do'stlaringiz bilan baham:
1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling