Question : 01
Samantha interviews many candidates from different colleges using coding challenges and
contests. Write a query to print the contest_id, hacker_id, name, and the sums of
total_submissions, total_accepted_submissions, total_views, and total_unique_views for
each contest sorted by contest_id. Exclude the contest from the result if all four sums are 0 .
Note: A specific contest can be used to screen candidates at more than one college, but each
college only holds a screening contest.
Contests Table: The contest_id is the id of the contest, hacker_id is the id of the hacker who
created the contest, and name is the name of the hacker.
Colleges Table: The college_id is the id of the college, and contest_id is the id of the contest
that Samantha used to screen the candidates.
Challenges Table: The challenge_id is the id of the challenge that belongs to one of the
contests whose contest_id Samantha forgot, and college_id is the id of the college where the
challenge was given to candidates.
View_Stats Table: The challenge_id is the id of the challenge, total_views is the number of
times the challenge was viewed by candidates, and total_unique_views is the number of times
the challenge was viewed by unique candidates.
Submission_Stats Table: The challenge_id is the id of the challenge, total_submissions is the
number of submissions for the challenge, and total_accepted_submission is the number of
submissions that achieved full scores.
Question : 02
Julia conducted a 15 days of learning SQL contest. The start date of the contest was March 01,
2025 and the end date was March 15, 2025. Write a query to print the total number of unique
hackers who made at least 1 submission each day (starting on the first day of the contest), and
find the hacker_id and name of the hacker who made the maximum number of submissions
each day. If more than one such hacker has a maximum number of submissions, print the
lowest hacker_id. The query should print this information for each day of the contest, sorted
by the date.
The following tables hold contest data:
Hackers Table: The hacker_id is the id of the hacker, and name is the name of the hacker.
Submissions Table: The submission_date is the date of the submission, submission_id is the
id of the submission, hacker_id is the id of the hacker who made the submission, and score is
the score of the submission.
Question : 03
You are given three tables: Students, Friends and Packages. Students contain two columns: ID
and Name. Friends contains two columns: ID and Friend_ID (ID of the ONLY best friend).
Packages contain two columns: ID and Salary (offered salary in $ thousands per month).
Write a query to output the names of those students whose best friends got offered a higher
salary than them. Names must be ordered by the salary amount offered to the best friends. It is
guaranteed that no two students get the same salary offer.
Students Table:
Friends Table:
Packages Table: