Type of Triangle in MYSQL

前端 未结 18 2360
执念已碎
执念已碎 2020-12-09 11:48

Problem statement:

Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the followin

18条回答
  •  一生所求
    2020-12-09 12:18

    Give it a try. That should definitely work.

    SELECT
      CASE
        WHEN A + B <= C OR A + C <= B OR B + C <= A 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
    FROM TRIANGLES;

提交回复
热议问题