We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. SQL
  3. Advanced Select
  4. Type of Triangle
  5. Discussions

Type of Triangle

Problem
Submissions
Leaderboard
Discussions

Sort 2311 Discussions, By:

recency

Please Login in order to post a comment

  • siddharthgandhi9
    10 hours ago+ 1 comment

    when more than one condition use cases

    select case WHEN A=B AND B=C THEN 'Equilateral' WHEN A + B <= C OR A + C <= B OR B + C <= A THEN 'Not A Triangle' WHEN A = B OR B = C OR A = C THEN 'Isosceles' WHEN A <> B AND A <> C AND B <> C THEN 'Scalene' end 'triangle type' from TRIANGLES

    0|
    Permalink
  • ljnacion
    12 hours ago+ 1 comment

    What's wrong here? :'(

    select (case when a = b and b = c then 'Equilateral' when a = b or b = c or a = c then 'Isosceles' when a <> b and b <> c and a <> c then 'Scalene' when a + b <= c or b + c <= a or a + c <= b then 'Not A Triangle' end) from triangles;

    0|
    Permalink
  • harshavardhan245
    2 days ago+ 0 comments

    select case when a+b <= c or a+c <= b or b+c <= a then 'not a triangle' when a= b or b= c or c= a then 'isosceles' when a = b and b = c and c = a then 'equilateral' when a != b and B != c and a != c then 'Scalene' end from triangles;

    whats wrong with query??? pls help

    0|
    Permalink
  • dwayne_mcmurchy
    3 days ago+ 0 comments
    SELECT 
      CASE 
        WHEN A = B AND B = C THEN 'Equilateral'
        WHEN A + B <= C OR A + C <= B OR B + C <= A THEN 'Not A Triangle'
        WHEN A <> B AND A <> C AND B <> C THEN 'Scalene'
        WHEN A = B OR B = C OR A = C THEN 'Isosceles'
      END AS triangle_type
    FROM triangles;
    
    0|
    Permalink
  • pulkit0928
    3 days ago+ 1 comment

    select case when a+b <= c or a+c <= b or b+c <= a then 'not a triangle' when a = b and b = c then 'equilateral' when a= b or b= c or c= a then 'isosceles' when a != b and B != c and a != c then 'Scalene' end from triangles; my output is same as the expected one but why it is till wrong?

    0|
    Permalink
Load more conversations

Need Help?


View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy