-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathType of Triangle.sql
More file actions
20 lines (18 loc) · 873 Bytes
/
Copy pathType of Triangle.sql
File metadata and controls
20 lines (18 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
SELECT
CASE
WHEN A + B > C AND A + C > B AND B + C > A THEN -- 2 zijden moet >= langste zijde zijn
CASE
WHEN A = B AND B = C THEN 'Equilateral' -- 3 zijden gelijk
WHEN A = B OR B = C OR A = C THEN 'Isosceles' -- 2 zijden gelijk
ELSE 'Scalene' -- geen gelijke zijden
END
ELSE 'Not A Triangle'
END
FROM TRIANGLES
/*
Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table:
Equilateral: It's a triangle with sides of equal length.
Isosceles: It's a triangle with sides of equal length.
Scalene: It's a triangle with sides of differing lengths.
Not A Triangle: The given values of A, B, and C don't form a triangle.
*/