Top Competitors

Sort by

recency

|

2327 Discussions

|

  • + 1 comment

    What is error in this? please help

    select A.hacker_id, name from (select hacker_id, count(challenge_id) as num from (select A.challenge_id, A.hacker_id, submission_id, difficulty_level, target, B.score as obtained from (select challenge_id, hacker_id, A.difficulty_level, score as target from Challenges as A inner join Difficulty as B on A.difficulty_level = B.difficulty_level) as A inner join Submissions as B on A.challenge_id = B.challenge_id where B.score = target) as A group by hacker_id having count( challenge_id)>1) as A inner join Hackers as B on A.hacker_id = B.hacker_id order by num desc, A.hacker_id asc

  • + 0 comments
    with get_A as
    (
    select
    A.hacker_id, count(A.Challenge_Id) Total_no_of_challenges
    from 
    submissions A 
    join challenges B on A.Challenge_Id=B.Challenge_Id 
    join difficulty C on B.difficulty_level=C.difficulty_level 
    where A.score = C.score
    group by A.hacker_id
    having count(A.Challenge_Id)>1
    )
    select x.hacker_id, y.name
    from get_A x join hackers y on x.hacker_id=y.hacker_id
    order by x.Total_no_of_challenges desc, x.hacker_id;
    
  • + 0 comments

    MS SQL

    SELECT H.hacker_ID, H.name
    FROM Submissions S
    INNER JOIN Challenges C ON C.Challenge_ID = S.Challenge_ID
    INNER JOIN Difficulty D ON D.Difficulty_Level = C.Difficulty_Level
    INNER JOIN Hackers H ON H.hacker_ID = S.hacker_ID
    WHERE S.Score = D.Score
    GROUP BY H.hacker_ID, H.name
    HAVING COUNT(S.Challenge_ID) > 1
    ORDER BY COUNT(S.Challenge_ID) DESC, H.hacker_ID ASC;
    
  • + 0 comments

    Simple Solution

    WITH temp_table AS(
        SELECT a.hacker_id, d.name, a.challenge_id, a.score from submissions as a
        INNER JOIN challenges AS b
        ON a.challenge_id = b.challenge_id
        INNER JOIN difficulty AS c
        on b.difficulty_level = c.difficulty_level
        INNER JOIN hackers as d
        on a.hacker_id = d.hacker_id
        WHERE a.score = c.score
    )
    
    -- Now showing details for all hacker who scored full  
    
    SELECT hacker_id, name FROM temp_table
    GROUP BY name, hacker_id
    HAVING COUNT(score)>1
    ORDER BY COUNT(score) desc, hacker_id asc;
    
  • + 1 comment

    what is the issue with my code?

    Select Concat(hacker_id,' ', name) as xyz from ( Select Q.hacker_id , H.name from Hackers as H left join (Select s.hacker_id,s.score from Difficulty as d left join Submissions as s on d.score = s.score)Q on H.hacker_id = Q.hacker_id group by hacker_id , name having count() > 1 order by count() DESC , hacker_id) t