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.
- Prepare
- SQL
- Advanced Select
- Type of Triangle
- Discussions
Type of Triangle
Type of Triangle
Sort by
recency
|
3575 Discussions
|
Please Login in order to post a comment
i had select all from triangles to check, on the 8 row value is 20 20 40 So, why result on the 8 row is "Not A Triangle"? It's must be Isosceles
MySQL
If you are asking why the code its wrong. First, check if the triangle exist before the Isosceles condition.
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 B = C OR A = C THEN 'Isosceles' ELSE 'Scalene' END AS TRIANGLE_TYPE FROM TRIANGLES;