File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Solutions/0610-triangle-judgement Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ <p >Table: <code >Triangle</code ></p >
2+
3+ <pre >
4+ +-------------+------+
5+ | Column Name | Type |
6+ +-------------+------+
7+ | x | int |
8+ | y | int |
9+ | z | int |
10+ +-------------+------+
11+ In SQL, (x, y, z) is the primary key column for this table.
12+ Each row of this table contains the lengths of three line segments.
13+ </pre >
14+
15+ <p >  ; </p >
16+
17+ <p >Report for every three line segments whether they can form a triangle.</p >
18+
19+ <p >Return the result table in <strong >any order</strong >.</p >
20+
21+ <p >The  ; result format is in the following example.</p >
22+
23+ <p >  ; </p >
24+ <p ><strong class =" example " >Example 1:</strong ></p >
25+
26+ <pre >
27+ <strong >Input:</strong >
28+ Triangle table:
29+ +----+----+----+
30+ | x | y | z |
31+ +----+----+----+
32+ | 13 | 15 | 30 |
33+ | 10 | 20 | 15 |
34+ +----+----+----+
35+ <strong >Output:</strong >
36+ +----+----+----+----------+
37+ | x | y | z | triangle |
38+ +----+----+----+----------+
39+ | 13 | 15 | 30 | No |
40+ | 10 | 20 | 15 | Yes |
41+ +----+----+----+----------+
42+ </pre >
Original file line number Diff line number Diff line change 1+ SELECT x, y, z,
2+ IF (x + y > z AND x + z > y AND y + z > x, " Yes" , " No" ) AS triangle
3+ FROM Triangle
You can’t perform that action at this time.
0 commit comments