Given Clients table
+------+--------------+----------+
| ID   |  Name        |  Summa   |
+------+--------------+----------+
| 1    |  Sasha       |  4000    |
| 2    |  Marina      |  2000    |
| 3    |  Stepan      |   0      |
| 4    |  Klara       |  NULL    |
+------+--------------+----------+
After it is updated using:
UPDATE Clients SET Summa = Summa + 700
What will be the result of the following query execution?
SELECT AVG(Summa) FROM Clients;
Explanation
If binary arithmetic operator (+ in our case) accepts NULL as one of its arguments, the result will always be NULL.
Aggregate functions (like AVG() in our case) ignore NULL values.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты