commit f70c862f2ab91fe82a4550ba033cf78317552e24 parent 0ee99efcbae18af28bb859be05326ffd816243ae Author: AndrewLockVI <andrewlaack1@gmail.com> Date: Tue, 18 Apr 2023 21:51:34 -0500 Completed triangle judgement sql query problem Diffstat:
| A | triangle-judgement/triangle-judgement.sql | | | 9 | +++++++++ |
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/triangle-judgement/triangle-judgement.sql b/triangle-judgement/triangle-judgement.sql @@ -0,0 +1,9 @@ +--Find if the lengths of sides can make a triangle and add attribute that states yes or no if it can +--Name that attribute triangle +--Runtime: 538ms Beats: 35.62% +SELECT t.x, t.y, t.z, +CASE + WHEN x + y > z AND y+x > z AND z+y > x AND z+x > y THEN "Yes" + WHEN y >= x+z OR z >= x+y OR x >= y+z THEN "No" + END AS triangle +FROM Triangle AS t