We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Select
case(
when a=b and b=c and a=c then 'equilateral'
when a!=b and a!=c and b!=c then 'scalene'
when a+b<=c or a+c<=b or b+c<=a then 'not a triangle'
when (a=b and b!=c) or (b=c and b!=a) or (a=c and c!=b) then 'isoceles')
else 'no'
end case
from trianlges
for the above i get the error:
- ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'when a=b and b=c and a=c then 'equilateral'
when a!=b and a!=c and b!=c then' at line 3
Please help me spot the error and why this query wouldn't work
``
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Type of Triangle
You are viewing a single comment's thread. Return to all comments →
Select case( when a=b and b=c and a=c then 'equilateral' when a!=b and a!=c and b!=c then 'scalene' when a+b<=c or a+c<=b or b+c<=a then 'not a triangle' when (a=b and b!=c) or (b=c and b!=a) or (a=c and c!=b) then 'isoceles') else 'no' end case from trianlges
Please help me spot the error and why this query wouldn't work