Попробуй решить



Дана таблица:



| OrderID | CustomerID | OrderDate | Amount |

|---------|------------|------------|--------|

| 1 | 101 | 2024-01-01 | 100 |

| 2 | 102 | 2024-01-02 | 200 |

| 3 | 101 | 2024-01-05 | 150 |

| 4 | 103 | 2024-01-07 | 300 |

| 5 | 101 | 2024-01-17 | 50 |

| 6 | 104 | 2024-01-15 | 400 |

| 7 | 102 | 2024-01-20 | 100 |

| 8 | 103 | 2024-01-21 | 200 |





Какой результат вернет следующий запрос?



SELECT CustomerID, SUM(Amount) AS TotalAmount

FROM Orders

WHERE OrderDate BETWEEN '2024-01-01' AND '2024-01-15'

GROUP BY CustomerID

HAVING COUNT(*) > 1;




Варианты ответа:

1. CustomerID = 101, TotalAmount = 250

2. CustomerID = 101, TotalAmount = 300

3. CustomerID = 102, TotalAmount = 200

4. CustomerID = 103, TotalAmount = 500



Решение в комментариях 😊