• + 1 comment

    I had very similar code but I put the 'Iscoceles' case statment before the 'Not a Triangle' one and it caused an error. The order in which you check the statments can really reduce the logic in your code :)

    SELECT CASE WHEN C >= A + B THEN 'Not A Triangle' WHEN A = B AND B = C THEN 'Equilateral' WHEN A = B OR A = C OR B = C THEN 'Isosceles' ELSE 'Scalene' END AS 'Triangles' FROM TRIANGLES;