sqlteaching
sqlteaching copied to clipboard
Suggestion to Improve "Coalesce" Task with More Comprehensive Data
Hi,
First of all, thank you for the great SQL teaching resource I really enjoyed the exercises.
While working on the final task titled "Coalesce", I noticed that the current dataset might not fully evaluate the intended logic of prioritizing weapons. Specifically, both COALESCE(tank, gun, sword) and COALESCE(tank, sword, gun) return the same output due to the absence of a case where tank is NULL but both gun and sword are present.
I think adding an extra row like this would make the exercise more complete:
INSERT INTO fighters (name, gun, sword, tank)
VALUES ('alper', 'pistol', 'katana', NULL);
This would ensure that the order of precedence in COALESCE is actually tested.
Thanks again for the helpful content!
Best regards, Alper