HackerRank MySQL - Type of Triangle

Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table:

  1. /*
  2. Enter your query here and follow these instructions:
  3. 1. Please append a semicolon ";" at the end of the query and enter your query in a single line to avoid error.
  4. 2. The AS keyword causes errors, so follow this convention: "Select t.Field From table1 t" instead of "select t.Field From table1 AS t"
  5. 3. Type your code immediately after comment. Don't leave any blank line.
  6. */
  8. WHEN A + B <= C
  9. OR A + C <= B
  10. OR B + C <= A THEN 'Not A Triangle'
  11. WHEN A = B
  12. AND B = C THEN 'Equilateral'
  13. WHEN A = B
  14. OR A = C
  15. OR B = C THEN 'Isosceles'
  16. ELSE 'Scalene'
  17. END
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

donate a cup of tea :)

Join Our Facebook Group

Share this solution


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube