You are viewing a single comment's thread. Return to all comments →
will not work for cases like 12 10 1 <- This will produce output as scalene byt it should not be a triangle.
SELECT * FROM (
WHEN (A + B <= C) OR (B + C <= A) OR (C + A <= B) THEN 'Not A Triangle'
WHEN (A = B AND B = C AND C = A) THEN 'Equilateral'
WHEN (A = B AND C <> A) OR (A <> B AND B = C ) OR (A = C AND B <> C ) THEN 'Isosceles'
WHEN (A <> B AND B <> C AND C <> A) THEN 'Scalene'
END ) AS TRIANGLE_TYPE