• + 1 comment

    Can't understand why this query is wrong? Can anyone explain please?

    select case
               when (A+B)>C or (B+C)>A or (C+A)>B then
                                                        case when A=B and B=C then 'Equilateral'
                                                             when (A=B and B!=C) OR (B=C and C!=A) OR (A=C and B!=A) THEN 'Isosceles'                                                                when (A!=B and B!=C) then 'Scalene'
               else 'Not A Triangle'
               end as triangle_type
    from TRIANGLES;
    
    • + 0 comments

      (A+B)>C or (B+C)>A or (C+A)>B

      This is most likely the issue. This condition is true even when it isn't a triangle. The example problem shows (13, 14, 30). * (13+14)>30? FALSE * (14+30)>13? TRUE * (13+30)>14? TRUE F | T | T = T