Skip to main content

Leetcode and HackerRank SQL

A set of Leetcode SQL questions is available here.

Following is the directory structure of this set:

├── Easy
│ ├── Actors who cooperated with Directors atleast three times.sql
│ ├── Ads performance.sql
│ ├── Article views.sql
│ ├── Average selling price.sql
│ ├── Big Countries.sql
│ ├── Biggest Single number.sql
│ ├── Classes more than 5 students.sql
│ ├── Combine two tables.sql
│ ├── Consecutive available seats.sql
│ ├── Create Session bar chart.sql
│ ├── Customer placing the largest number of orders .sql
│ ├── Customers who never order.sql
│ ├── Delete duplicate emails.sql
│ ├── Duplicate Emails.sql
│ ├── Employee Bonus.sql
│ ├── Employees earning more than their managers.sql
│ ├── Find Customer Refree.sql
│ ├── Find the team size.sql
│ ├── Friend Requests 1.sql
│ ├── Friendly Movies streamed list.sql
│ ├── Game Play Analysis 1.sql
│ ├── Game play analysis 2.sql
│ ├── Group sold products by the date.sql
│ ├── Immediate food delivery.sql
│ ├── List the products ordered in a period.sql
│ ├── Not Boring movies.sql
│ ├── Number of comments per post.sql
│ ├── Product Sales Analysis 1.sql
│ ├── Product Sales Analysis 2.sql
│ ├── Project Employees 1.sql
│ ├── Project Employees 2.sql
│ ├── Queries quality and percentage.sql
│ ├── Reformat department table.sql
│ ├── Replace employee id with unique identifier.sql
│ ├── Reported posts.sql
│ ├── Rising Temperature.sql
│ ├── Sales Analysis 1.sql
│ ├── Sales Analysis 2.sql
│ ├── Sales Analysis 3.sql
│ ├── Sales Person.sql
│ ├── Second highest salary.sql
│ ├── Shortest Distance.sql
│ ├── Students and Examinations.sql
│ ├── Students with invalid departments.sql
│ ├── Swap Salary.sql
│ ├── Top Travellers.sql
│ ├── Triangle Judgement.sql
│ ├── User Activity for past 30 days 2.sql
│ ├── User activity for past 30 days 1.sql
│ └── Weather type in each country.sql
├── Hard
│ ├── Average Salary.sql
│ ├── Cumulative Salary.sql
│ ├── Department top three salaries.sql
│ ├── Find median given frequency of numbers.sql
│ ├── Find the quiet students in the exam.sql
│ ├── Game Play Analysis 5.sql
│ ├── Human traffic of stadium.sql
│ ├── Market Analysis 2.sql
│ ├── Median Employee Salary.sql
│ ├── Number of transactions per visit.sql
│ ├── Report contiguous dates.sql
│ ├── Sales by day of the week.sql
│ ├── Students report by geography.sql
│ ├── Total sales amount by year.sql
│ ├── Tournament Winners.sql
│ ├── Trips and Users.sql
│ └── User purchase platform.sql
└── Medium
├── Active Businesses.sql
├── Active Users.sql
├── Activity Participants.sql
├── All people report to the given manager.sql
├── Apples & Oranges.sql
├── Article Views 2.sql
├── Calculate Salaries.sql
├── Capital Gain.sql
├── Consecutive Numbers.sql
├── Count student number in departments.sql
├── Countries you can safely invest in.sql
├── Customers who bought a, b but not c.sql
├── Customers who bought all products.sql
├── Department Highest Salary.sql
├── Evaluate Boolean Expressions.sql
├── Exchange Seats.sql
├── Find the start and end number of continuous ranges.sql
├── Friend Requests 2.sql
├── Game Play Analysis 3.sql
├── Game Play Analysis 4.sql
├── Get highest answer rate question.sql
├── Get the second most recent activity.sql
├── Highest grade for each student.sql
├── Immediate Food Delivery 2.sql
├── Investments in 2016.sql
├── Last person to fit in the elevator.sql
├── Managers with atleast 5 direct reports.sql
├── Market Analysis 1.sql
├── Monthly Transaction 2.sql
├── Monthly Transactions 1.sql
├── Movie Rating.sql
├── NPV Queries.sql
├── New users daily count.sql
├── Nth Highest salary.sql
├── Page Recommnedations.sql
├── Product Price at a given date.sql
├── Product Sales Analysis 3.sql
├── Project Employees 3.sql
├── Rank scores.sql
├── Rectangles Area.sql
├── Reported Posts 2.sql
├── Restaurant growth.sql
├── Running total for different genders.sql
├── Second degree follower.sql
├── Shortest distance in a plane.sql
├── Team scores in football match.sql
├── Tree Node.sql
├── Unpopular Books.sql
└── Winning Candidate.sql

Another set of solved Leetcode questions is available on this blog.

HackerRank set is also available on the same blog here.