LEETCODE I’m currently deep in the trenches of the SQL 50 challenge, and let’s just say... it’s a mood. One minute, I’m staring at a "Wrong Answer" screen, questioning if I even know what a JOIN is anymore. The logic seems perfect, the syntax is clean, but the test case just won't budge. It’s frustrating, it’s humbling, and it’s a total brain-burn. But then... it happens. You tweak one subquery, add a HAVING clause, or fix a DISTINCT count, and you hit that Submit button. Seeing that green "Accepted" text pop up is a massive hit of dopamine. There’s no feeling quite like beating 78% of other users with a query you just built from scratch. It makes every "Wrong Answer" worth it. What I’m learning through the grind: Edge Cases are everything: The real world (and LeetCode) is messy. Learning to account for NULLs and duplicates is where the real skill is. Subqueries are powerful: Today’s win involved using a subquery within a HAVING clause to match counts—it’s like a puzzle fitting together. Consistency > Speed: I’m pushing for all 50 questions, but I’m making sure I actually understand the "why" behind every solution. Progress isn't a straight line; it’s a series of red errors until you get that one green win. Getting back to the grind now. Only a few more to go! #LeetCode #SQL #DataAnalysis #100DaysOfCode #CodingLife #DopamineHit #ProblemSolving #TechJourney #MySQL
HARSH ARORA’s Post
More Relevant Posts
-
A senior developer looked at my SQL query and said: "It works. But it will kill the database in production." I had HackerRank Advanced SQL. Passed every test. Felt good about it. Turns out I had been testing my memory, not my understanding. He pointed at three things: My correlated subquery was running once per row. Not once total. On 50 million rows, that's 50 million subqueries. I had wrapped the column in a function. The index existed. It was doing nothing. I had never run EXPLAIN before shipping a single query to production. I didn't argue. I just felt stupid for a while. Then I went and fixed my mental model. The gap nobody talks about: certifications test whether you know SQL. Production tests whether you know what breaks SQL. These are not the same exams. Saved this cheat sheet for anyone who is still on the wrong exam: → Window functions instead of correlated subqueries → CTEs instead of nested subqueries — easier to read, easier to debug → EXISTS instead of NOT IN—NOT IN silently returns zero rows when the subquery has NULLs → Never wrap an indexed column in a function → EXPLAIN before every query that goes anywhere near production Save this. #SQL #DataEngineering #DataAnalytics #Python #Learning
To view or add a comment, sign in
-
-
🚀 Completed 50 LeetCode SQL Problems! 🧠💻 After learning SQL fundamentals 📚 and practicing on HackerRank, I thought SQL problems would be easy. But solving 50 SQL problems on LeetCode still took a lot of effort and learning. ⚡ The approach that helped me the most: 🔍 Understand the problem and test cases 🧪 Think about edge cases 🧩 Identify the right concept (joins, subqueries, CTEs, window functions) 🪜 Break the problem into small steps and test them ✍️ One simple thing that helped a lot: Notebook & Pen. It might feel boring since many developers jump straight to coding, but writing the logic step-by-step helped me build a clear thought process. Also learned a very important concept: ⚙️ Logical SQL Execution Order FROM → JOIN → ON → WHERE → GROUP BY → HAVING → SELECT → DISTINCT → ORDER BY → LIMIT / TOP 💡 In many cases, the logic is correct, but the issue arises in its execution. For me, the objective has never been limited to achieving a green checkmark ✅; rather, it is to understand why the query works and to explore multiple approaches to solving the problem 💡. On to the next challenge! 🚀🔥 #SQL #LeetCode #Learning #ProblemSolving
To view or add a comment, sign in
-
I just shipped something I'm really proud of. 🚀 Semicolon — an open-source SQL formatter that turns messy, unreadable queries into clean, structured code in seconds. You don’t need to decode a wall of SQL just to find where the JOIN stops and the WHERE starts. You don’t need to spend minutes formatting it perfectly. SemiColon handles it for you instantly. Just install it, point it at your SQL, and you’re done. → pip install semicolonfmt → semicolon query.sql (format a file) → semicolon . (format everything in a directory) What it does: ✅ Formats messy SQL into clean, consistent, scannable queries ✅ Works on single files or entire directories ✅ CI/CD check mode so unformatted SQL never slips into prod ✅ Pre-commit hook support ✅ Zero config. Just run it. It's open source, it's free, and it's just getting started. ⭐ If you like it, give it a star on GitHub 🔧 Test it, push it to the limits, and open a PR if you spot something off 🔗 https://lnkd.in/dmYG-t4c Clean SQL is not a nice-to-have. It's a craft. Let's treat it like one. 💪 #OpenSource #SQL #PostgreSQL #Python #DevTools #BuildingInPublic #CleanCode
To view or add a comment, sign in
-
Just earned the SQL 50 badge on LeetCode 🎯 Honestly, if you’re starting with SQL - this is all you need. These 50 problems cover almost every important concept, from basics to advanced queries. Big takeaway? 👉 Window Functions are a game changer. Once you get them, a lot of “complex” problems become straightforward. If you’re preparing for interviews or strengthening your backend/data skills, I highly recommend going through this set. 📌 Want MySQL notes covering everything from basic to advanced? Check out my repository: https://lnkd.in/g8CTyMKC Consistency > Everything. #SQL #LeetCode #DataStructures #CodingJourney #BackendDevelopment #Learning #Tech
To view or add a comment, sign in
-
-
Learning SQL separately from Django — and it hits different when you see the raw logic behind the ORM. Today's practice: → INSERT INTO — 9 records into a Books table → SELECT * — full table query → SELECT Price FROM Books — targeted column fetch No framework. No abstraction. Just SQL talking directly to the database. Foundations matter. Building mine. #SQL #MySQL #BackendDevelopment #LearningInPublic
To view or add a comment, sign in
-
-
Most developers optimize SQL queries by guessing. I used to do the same tweak an index here, rewrite a join there, and hope for the best. Then I started actually reading what the database was telling me. EXPLAIN ANALYZE changed how I debug slow queries entirely. Here's what it helps you understand: • How your query is actually being executed • Which indexes are (or aren't) being used • Where the time is really being spent • Why performance silently drops under load The workflow I now follow every time: 1️⃣ Run the query — note the response time 2️⃣ Run EXPLAIN — understand the execution plan 3️⃣ Add indexes or adjust joins based on what you see 4️⃣ Run EXPLAIN ANALYZE — confirm the improvement is real A few things that used to trip me up: → type: ALL means a full table scan — almost always a red flag → key: NULL means no index is being used → rows: 500000 means the DB is scanning way more than it should Database optimization isn't about rewriting everything from scratch. It's about understanding the execution plan and fixing the right thing. I put together a quick reference guide on how different databases (PostgreSQL, MySQL) support EXPLAIN ANALYZE save it for your next debugging session. #SQL #PostgreSQL #MySQL #BackendDevelopment #DatabaseOptimization #SoftwareEngineering #Python #Django #FastAPI
To view or add a comment, sign in
-
🗄️ An Introduction to SQL SQL (Structured Query Language) is the standard language for managing and manipulating relational databases. It allows you to create, read, update, and delete data (CRUD operations) in a structured way. ✅ Schemas & basics ✅ Basic CRUD ✅ SELECT basics ✅ JOINs ✅ Aggregation & GROUP BY ✅ Subqueries & CTEs ✅ Window functions ✅ Transactions & concurrency ✅ Indexes & performance Save & share with your team! Download Our Free Full-Stack Developer Starter Kit ➡️ https://buff.ly/JbI0Qof --- If you found this guide helpful, follow TheDevSpace | Dev Roadmap, w3schools.com, and JavaScript Mastery for more tips, tutorials, and cheat sheets on web development. Let's stay connected! 🚀 #SQL #Databases #Query #Postgres #MySQL
To view or add a comment, sign in
-
🗄️ An Introduction to SQL SQL (Structured Query Language) is the standard language for managing and manipulating relational databases. It allows you to create, read, update, and delete data (CRUD operations) in a structured way. ✅ Schemas & basics ✅ Basic CRUD ✅ SELECT basics ✅ JOINs ✅ Aggregation & GROUP BY ✅ Subqueries & CTEs ✅ Window functions ✅ Transactions & concurrency ✅ Indexes & performance Save & share with your team! Download Our Free Full-Stack Developer Starter Kit ➡️ https://buff.ly/JbI0Qof --- If you found this guide helpful, follow TheDevSpace | Dev Roadmap, w3schools.com, and JavaScript Mastery for more tips, tutorials, and cheat sheets on web development. Let's stay connected! 🚀 #SQL #Databases #Query #Postgres #MySQL
To view or add a comment, sign in
-
SQL Progress: Logic & CASE Statements! Today I solved another Medium challenge on LeetCode. This problem was a great lesson in how to calculate percentages and rates directly in SQL. What I learned today: 1. AVG with CASE WHEN: I learned that I can use AVG(CASE WHEN condition THEN 1.0 ELSE 0.0 END) to calculate a rate. It’s a very clear way. 2. Handling NULLs in Rates: By using a LEFT JOIN between the Signups and Confirmations tables, I ensured that users with no actions are still included, and the AVG function automatically treats them as 0 if they don't meet the "confirmed" criteria. 3. Precision with ROUND: Used ROUND(..., 2) to make sure the final confirmation rate is clean and meets the required format(0.00). I would love to learn from your experience: is ther another methods cleaner? قليل مستمر خير من كثير منقطع #SQL #DataEngineering #PostgreSQL #LeetCode #100DaysOfCode #DataAnalytics #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 33 of My SQL Learning Journey Today I solved a HackerRank problem and learned an important SQL concept along the way 🔥 🔹 Problem: Find the maximum total earnings (salary × months) and count how many employees have that earning 🔹 Solution: SELECT (salary * months) AS earnings, COUNT(*) FROM Employee GROUP BY (salary * months) ORDER BY earnings DESC FETCH FIRST 1 ROW ONLY; 🔹 What I Learned (Important 💡): Initially, I used GROUP BY earnings, but it caused an error ❌ 👉 Reason: GROUP BY is executed before SELECT, so column aliases like earnings are not recognized ✔️ Fix: Use the actual expression instead of alias 🔹 Key Concepts: SQL execution order (FROM → WHERE → GROUP BY → SELECT → ORDER BY) Grouping using computed values Writing DB-compatible queries 💡 Debugging errors taught me more than just solving the problem! Step by step towards becoming better 🚀 #SQL #HackerRank #90DaysOfCode #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development