Write a query identifying the type of each record in the TRIANGLES table using its three side lengths.
Answers
Answered by
0
there are only 3 sides in a triangle
Answered by
0
Answer:
SELECT IF(A+B>C AND A+C>B AND B+C>A, IF(A=B AND B=C, 'Equilateral', IF(A=B OR B=C OR A=C, 'Isosceles', 'Scalene')), 'Not A Triangle') FROM TRIANGLES;
Explanation:
Now turn to the query. Check whether three sides have the same length and query will be “SELECT IF(A+B>C AND A+C>B AND B+C>A, IF(A=B AND B=C, ‘Equilateral’, IF()), ‘Not A Triangle’) FROM TRIANGLES”. Then check whether two sides have the same length and the query will be “SELECT IF(A+B>C AND A+C>B AND B+C>A, IF(A=B AND B=C, ‘Equilateral’, IF(A=B OR B=C OR A=C, ‘Isosceles’, ‘Scalene’)), ‘Not A Triangle’) FROM TRIANGLES”.
Similar questions