https://leetcode.com/problems/triangle-judgement/
Triangle Judgement - LeetCode
Can you solve this real interview question? Triangle Judgement - Table: Triangle +-------------+------+ | Column Name | Type | +-------------+------+ | x | int | | y | int | | z | int | +-------------+------+ In SQL, (x, y, z) is the primary key column for
leetcode.com
select x, y, z,
(case when x+y>z and y+z>x and x+z>y then 'Yes'
else 'No' end) as triangle
from triangle
이 문제를 풀기 위해서는 삼각형의 성립 조건을 알아야했다.
구글링을 통해 찾아본 결과, 두 변의 길이의 합이 나머지 한 변의 길이보다 커야 한다.
case 조건문을 활용해 해당 조건을 적용해서 풀었다.
'코딩테스트 > SQL' 카테고리의 다른 글
| [LeetCode][MySQL] Rearrange Products Table (0) | 2023.12.29 |
|---|---|
| [LeetCode][MySQL] Group Sold Products By The Date (0) | 2023.12.20 |
| [LeetCode][MySQL] Sales Person (0) | 2023.12.13 |
| [solvesql][SQLite] 할부는 몇 개월로 해드릴까요 (1) | 2023.12.07 |
| [solvesql][SQLite] 복수 국적 메달 수상한 선수 찾기 (1) | 2023.12.07 |