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.
I came up with nearly the same exact code. However I am receiving errors. I am getting "isoceles" returned instead of "Not a triangle" for one of the test cases.
SELECT
CASE
WHEN A = B AND B = C THEN 'Equilateral'
WHEN A = B OR A = C OR B = C THEN 'Isosceles'
WHEN A + B <= C OR A + C <= B OR B + C <= A THEN 'Not A Triangle'
ELSE 'Scalene'
END
FROM TRIANGLES;
Type of Triangle
You are viewing a single comment's thread. Return to all comments →
I came up with nearly the same exact code. However I am receiving errors. I am getting "isoceles" returned instead of "Not a triangle" for one of the test cases.
SELECT CASE WHEN A = B AND B = C THEN 'Equilateral' WHEN A = B OR A = C OR B = C THEN 'Isosceles' WHEN A + B <= C OR A + C <= B OR B + C <= A THEN 'Not A Triangle' ELSE 'Scalene' END FROM TRIANGLES;
HELP??