This table is auto-generated — don't edit it by hand, it'll just get overwritten anyway 🙂
LeetCode SQL Practice (20)
| # | Problem | Link |
|---|---|---|
| 1 | AverageTimeofProcessperMachine | Code |
| 2 | RisingTemperature | Code |
| 3 | GamePlayAnalysisIV | Code |
| 4 | ManagerswithatLeast5DirectReports | Code |
| 5 | FindCustomerReferee | Code |
| 6 | BigCountries | Code |
| 7 | NotBoringMovies | Code |
| 8 | ProductSalesAnalysisI | Code |
| 9 | ProjectEmployeesI | Code |
| 10 | ArticleViewsI | Code |
| 11 | ImmediateFoodDeliveryII | Code |
| 12 | MonthlyTransactionsI | Code |
| 13 | QueriesQualityandPercentage | Code |
| 14 | AverageSellingPrice | Code |
| 15 | ReplaceEmployeeIDWithTheUniqueIdentifier | Code |
| 16 | CustomerWhoVisitedbutDidNotMakeAnyTransactions | Code |
| 17 | PercentageofUsersAttendedaContest | Code |
| 18 | InvalidTweets | Code |
| 19 | RecyclableandLowFatProducts | Code |
| 20 | ConfirmationRate | Code |
This is my little SQL gym. I'm working through LeetCode's Top SQL 50 study plan, one query at a time, and dumping every solution here so I can watch the progress add up.
I'm not just trying to get a green checkmark — I actually enjoy the puzzle of it. How do you write a query that's not just correct, but clean, fast, and doesn't make the database cry? That's the fun part for me: joins, window functions, aggregations, all of it.
I got a little lazy about manually updating a table every time I add a solution, so I automated it:
- I drop a new
.sqlfile into/solutions/. - I push it to GitHub.
- A GitHub Action wakes up, runs
generate_table.py, and it scans the folder, figures out the problem number and name from the filename, and rebuilds the table below. - It commits the updated README right back to the repo. No copy-pasting, no forgetting to update a count.
📂 repository-root
├── 📂 .github/workflows/ # the robot that runs the script on every push
├── 📂 solutions/ # all my actual .sql answers live here
├── 📄 generate_table.py # reads the folder, writes the table below
└── 📄 README.md # you are here
If you're forking this to track your own SQL grind, here's the one rule that matters: name your files like this —
[ProblemNumber].[ProblemNameNoSpaces].sql
✅ 1757.RecyclableandLowFatProducts.sql
❌ 1757_recyclable_products.sql (wrong separator)
❌ 1757.sql (needs a name too)
Then just run:
python generate_table.pyand check the README updated itself.
Two things not to touch: the <!-- leetcode_sql:START --> / <!-- leetcode_sql:END --> comments — those are how the script knows where to inject the table. And keep all your .sql files directly inside /solutions/, not in subfolders.
That's it — happy querying! 🐘