Skip to content

Commit a831428

Browse files
committed
Type of Triangle solution with reference on better one found by someone
1 parent 36e97cf commit a831428

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- Hint: Better solution https://github.com/BlakeBrown/HackerRank-Solutions/blob/master/SQL/2_Advanced%20Select/01_Type%20of%20Triangle/Type%20of%20Triangle.mysql
2+
SELECT
3+
CASE
4+
WHEN A = B AND B = C THEN 'Equilateral'
5+
WHEN ( (A+B)<=C OR (A+C)<=B OR (B+C)<=A ) THEN 'Not A Triangle'
6+
WHEN (NOT ( (A+B)<=C OR (A+C)<=B OR (B+C)<=A )) AND (A=B OR C=B OR A=C) THEN 'Isosceles'
7+
ELSE 'Scalene'
8+
END
9+
END
10+
FROM TRIANGLES

0 commit comments

Comments
 (0)