Can Three Beams Form a Bracket
Problem
A fabrication shop logs sets of three metal beam lengths it plans to weld into a triangular bracket.
```
BeamSet
+----------+------+
| Column | Type |
+----------+------+
| side_a | int |
| side_b | int |
| side_c | int |
+----------+------+
Each row is one candidate set of three beam lengths.
```
Three lengths form a valid triangular bracket only if every pair of sides, added together, is strictly greater than the third side.
For each row return all three side lengths plus a column `can_form` that is `'Yes'` when the three lengths form a valid bracket and `'No'` otherwise.
Tables
Example rows — the live problem includes the full dataset.
| side_a | side_b | side_c |
|---|---|---|
| 14 | 16 | 31 |
| 9 | 12 | 14 |
Expected output
Your answer should return 2 rows with the columns side_a, side_b, side_c, can_form.
Starter code (SQL)
SELECT *
FROM BeamSet;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock