Skip to content

Commit 7acfb84

Browse files
committed
task: #610
1 parent 19362e4 commit 7acfb84

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Have a good contributing!
4343
- [586. Customer Placing the Largest Number of Orders](./leetcode/easy/586.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders.sql)
4444
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
4545
- [596. Classes With at Least 5 Students](./leetcode/easy/596.%20Classes%20With%20at%20Least%205%20Students.sql)
46+
- [610. Triangle Judgement](./leetcode/easy/610.%20Triangle%20Judgement.sql)
4647
2. [Medium](./leetcode/medium/)
4748
- [176. Second Highest Salary](./leetcode/medium/176.%20Second%20Highest%20Salary.sql)
4849
- [184. Department Highest Salary](./leetcode/medium/184.%20Department%20Highest%20Salary.sql)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Question 610. Triangle Judgement
3+
Link: https://leetcode.com/problems/triangle-judgement/description/
4+
5+
Table: Triangle
6+
7+
+-------------+------+
8+
| Column Name | Type |
9+
+-------------+------+
10+
| x | int |
11+
| y | int |
12+
| z | int |
13+
+-------------+------+
14+
In SQL, (x, y, z) is the primary key column for this table.
15+
Each row of this table contains the lengths of three line segments.
16+
17+
18+
Report for every three line segments whether they can form a triangle.
19+
20+
Return the result table in any order.
21+
*/
22+
23+
SELECT
24+
x,
25+
y,
26+
z,
27+
CASE
28+
WHEN (x + y) > z AND (x + z) > y AND (y + z) > x THEN 'Yes'
29+
ELSE 'No'
30+
END AS is_triangle
31+
FROM Triangle

0 commit comments

Comments
 (0)