Parenthesis NOT ALLOWED in SQL CASE
My MySQL journey!
Today I was trying to solve the valid triangle problem (GeekForGeeks article link) using MySQL 8.0 (in LeetCode). I was trying to use CASE statement and kept on getting error! My query was:
select x, y, z,
case
(when x + y > z and
y + z > x and
x + z > y then 'Yes'
else 'No' end) as triangle
from TriangleAfter a lot of searching through StackOverflow and MySQL documentations I found out what was wrong - I had an extra pair of parenthesis!!!
Correct query:
select x, y, z,
case
when x + y > z and
y + z > x and
x + z > y then 'Yes'
else 'No' end as triangle
from Triangle Note: No parenthesis after CASE.

