Har bir buyurtma bir nechta mahsulotdan iborat (order_items: qaysi mahsulotdan necha dona). Buyurtma bergan har bir mijoz uchun jami xarid summasini (quantity * price yig‘indisi) toping.
Natijani summa bo‘yicha kamayish tartibida chiqaring; summa teng bo‘lsa — ism bo‘yicha alifbo tartibida.
Namunaviy ma‘lumotlar
| id integer | name text | city text | phone text |
|---|---|---|---|
| 1 | Aziz Nazarov | Toshkent | +998901320957 |
| 2 | Laylo Mirzayev | Toshkent | +998908515871 |
| 3 | Alisher Mirzayev | Toshkent | +998905100438 |
| 4 | Anvar Mirzayev | Toshkent | NULL |
| 5 | Alisher Rahimov | Samarqand | NULL |
| 6 | Alisher Karimov | Samarqand | +998908534436 |
| 7 | Aziza Toshmatov | Toshkent | +998905550318 |
| id integer | name text | category text | price integer | stock integer |
|---|---|---|---|---|
| 1 | Sut | Oziq-ovqat | 2070000 | 18 |
| 2 | Noutbuk | Elektronika | 2590000 | 104 |
| 3 | Quloqchin | Elektronika | 1495000 | 64 |
| 4 | Velosiped | Sport | 1650000 | 5 |
| 5 | Non | Oziq-ovqat | 60000 | 97 |
| 6 | Kurtka | Kiyim | 2050000 | 35 |
| 7 | Gantel | Sport | 20000 | 29 |
| 8 | Mehrobdan chayon | Kitoblar | 1650000 | 69 |
| 9 | Sariq devni minib | Kitoblar | 2580000 | 0 |
| id integer | customer_id integer | order_date text |
|---|---|---|
| 1 | 1 | 2025-03-15 |
| 2 | 1 | 2025-03-16 |
| 3 | 1 | 2025-03-17 |
| 4 | 2 | 2025-06-25 |
| 5 | 2 | 2025-06-26 |
| 6 | 1 | 2025-06-17 |
| 7 | 5 | 2025-04-18 |
| 8 | 1 | 2025-09-19 |
| 9 | 3 | 2025-07-04 |
| 10 | 2 | 2025-07-03 |
| 11 | 1 | 2025-10-14 |
| 12 | 1 | 2025-05-15 |
| 13 | 3 | 2025-03-24 |
| 14 | 5 | 2025-03-02 |
| order_id integer | product_id integer | quantity integer |
|---|---|---|
| 1 | 8 | 1 |
| 1 | 9 | 1 |
| 1 | 4 | 2 |
| 2 | 9 | 1 |
| 2 | 1 | 4 |
| 2 | 7 | 3 |
| 3 | 1 | 1 |
| 3 | 6 | 1 |
| 4 | 5 | 3 |
| 5 | 4 | 1 |
| 5 | 6 | 3 |
| 6 | 3 | 5 |
| 7 | 3 | 2 |
| 7 | 5 | 5 |
| 7 | 2 | 5 |
| 8 | 4 | 5 |
| 9 | 6 | 4 |
| 9 | 1 | 2 |
| 9 | 9 | 3 |
| 10 | 2 | 3 |
| 10 | 8 | 4 |
| 10 | 3 | 2 |
| 11 | 6 | 1 |
| 11 | 5 | 2 |
| 11 | 1 | 2 |
| 12 | 1 | 2 |
| 12 | 2 | 3 |
| 13 | 4 | 5 |
| 14 | 1 | 5 |
Jadval tuzilishi (CREATE TABLE)
CREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT, city TEXT, phone TEXT); CREATE TABLE products (id INTEGER PRIMARY KEY, name TEXT, category TEXT, price INTEGER, stock INTEGER); CREATE TABLE orders (id INTEGER PRIMARY KEY, customer_id INTEGER, order_date TEXT); CREATE TABLE order_items (order_id INTEGER, product_id INTEGER, quantity INTEGER);
Natija
Ikki ustun: name, total. Tartib muhim.
Namunaviy ma‘lumotlarda kutilgan natija
| Aziz Nazarov | 56515000 |
| Alisher Mirzayev | 28330000 |
| Alisher Rahimov | 26590000 |
| Laylo Mirzayev | 25340000 |
Qatorlar aynan shu tartibda bo‘lishi kerak. Yechim yashirin, kattaroq ma‘lumotlarda ham tekshiriladi.