🚀 Day 5 – SQL Daily Challenge | Smart Sorting with Strings Today’s challenge focused on filtering and sorting data using string functions a small twist that really tests your understanding of SQL logic. 🔍 Problem: Query the names of students who scored more than 75 marks. Sort the results based on the last 3 characters of their names, and if multiple names share the same ending, sort them by ID (ascending). 🧠 Approach: Filter students with marks greater than 75 Use the RIGHT() function to extract the last 3 characters from each name Use these extracted characters for primary sorting Apply secondary sorting using ID for tie-breaking 💻 Solution: SELECT NAME FROM STUDENTS WHERE Marks > 75 ORDER BY RIGHT(Name, 3), ID; 📌 Key Learnings: ✔️ Using string functions like RIGHT() for sorting ✔️ Understanding multi-level sorting (ORDER BY) ✔️ Applying tie-breaker logic using ID ✔️ Realizing that sorting can be done on derived values, not just columns 💡 Takeaway: Even a simple dataset can introduce powerful concepts like custom sorting logic. Today’s challenge helped me understand how to manipulate strings and apply layered sorting effectively. 📌 Consistency continues — learning SQL one challenge at a time! #SQL #DataAnalytics #LearningInPublic #Day5 #30DaysChallenge #BeginnerJourney
SQL Challenge: Sorting Students by Last 3 Name Characters and ID
More Relevant Posts
-
I used to think SQL was very hard… until I saw it like this 👇 SQL is nothing but asking questions to your data. Imagine you have a table of students: Name | Marks Now think like this: 👉 “Show me all students” → "SELECT *" 👉 “Show me students with marks > 80” → "WHERE condition" That’s it. I was overcomplicating it by trying to memorize syntax. But once I started thinking in questions, it became much easier. If you're learning SQL: ❌ Don’t memorize ✅ Ask better questions Sometimes the problem is not SQL… It’s how we approach it. What topic in SQL confuses you the most right now? #SQL #DataEngineering #LearnSQL #CodingJourney #TechLearning #Beginners #CareerGrowth
To view or add a comment, sign in
-
-
🚀 Day 2 of My SQL Learning Journey Today I learned about the WHERE clause in SQL. 👉 WHERE is used to filter data based on specific conditions. Basic syntax: SELECT column_name FROM table_name WHERE condition; ✔ Helps in retrieving only the required data ✔ Can be used with operators like =, >, <, AND, OR 💡 Learning WHERE made me realize how powerful SQL is when working with large datasets. Excited to keep improving! 🔥 Next: INSERT statement 👀 #SQL #LearningJourney #Beginner #DataAnalytics #Day2 #LearnInPublic
To view or add a comment, sign in
-
-
Day 4 of learning SQL 🚀 Today I focused on making my queries more powerful and readable: ✔ LIMIT – controlling how many rows to return ✔ ORDER BY + LIMIT – finding top/bottom results ✔ OFFSET – skipping rows (useful for ranking like 2nd highest) ✔ Aliasing (AS) – making column names cleaner and more readable Example I practiced: SELECT department, AVG(salary) AS avg_salary FROM employees GROUP BY department ORDER BY avg_salary DESC LIMIT 1; Key learning today 💡 LIMIT is essential for real-world analysis (Top N queries) OFFSET helps in ranking (like finding 2nd or 3rd highest values) Aliasing makes queries more readable and professional Mistakes I made: Forgot GROUP BY while using AVG() ❌ Used wrong LIMIT with OFFSET ❌ Fixing these helped me understand query flow better. Goal: Become job-ready in SQL & Data Analysis 💪 #SQL #DataAnalytics #LearningInPublic #100DaysOfCode #BeginnerToPro #Alextheanalyst
To view or add a comment, sign in
-
-
📈 The Moment I Realized Writing SQL Isn’t Enough Early on, I thought: “If my query runs, I’m done.” Then I saw the same query: Run in seconds… by one person Take minutes… by another That’s when it clicked: 👉 SQL is not just about getting results 👉 It’s about getting results efficiently What I learned: 🔹 Small changes (indexes, joins) → huge performance gains 🔹 Understanding data modeling improves query design 🔹 Optimization = thinking, not just coding Now I always ask: “Can this query run faster?” What’s one SQL mistake you used to make? #Learning #SQL #DataAnalytics #Growth #SQLOptimization
To view or add a comment, sign in
-
I used to and still sometimes do jump straight into writing SQL queries. Open the dataset → start querying. But recently, I’ve been trying a different approach. Now I pause and ask: → What exactly am I trying to find? → What does each column actually represent? → What kind of result would make sense? Because writing queries is easy. Understanding the data is not. That small shift is slowly changing how I approach problems. Still learning, but it already feels more structured. Do you also take time to understand the data first, or jump into queries? 👇 #DataAnalytics #SQL #Learning #DataThinking
To view or add a comment, sign in
-
📊 SQL Insight: Write Smarter Queries, Not Longer Ones One thing that significantly improved my SQL skills over time: 👉 Using CTEs and Window Functions effectively Early on, I used to write long, complex queries with multiple subqueries. They worked — but they were hard to read, debug, and maintain. 🔍 What Changed? 🔹 CTEs (Common Table Expressions) Help break down complex logic into simple, readable steps. Think of them as temporary result sets that make queries cleaner. 🔹 Window Functions Allow you to perform calculations across rows without losing detail. Perfect for ranking, running totals, and comparisons. ⚙️ Why This Matters Cleaner and more readable queries Easier to debug and maintain Better suited for analytical use cases 💡 Key Takeaway Good SQL isn’t just about getting the result — it’s about writing queries that others can understand. #SQL #DataAnalytics #DataAnalyst #WindowFunctions #Analytics #Learning
To view or add a comment, sign in
-
While brushing up my SQL skills, I came across a problem that taught me an important lesson. It wasn’t really about writing the query or cracking the solution. It was about clarity and keeping things simple. I spent time trying different approaches, adding more logic, and overthinking it. Then I paused and focused on what the problem was actually asking. Everything became clearer. What helped: - Define the expected output - Identify the base data - Build step by step 💡 Takeaway: Problems often feel hard not because they are complex, but because we lose clarity. Simplifying the thinking solves half the problem. #SQL #Learning #ProblemSolving #DataEngineering #KeepItSimple
To view or add a comment, sign in
-
Day 8 of learning SQL 🚀 Today I focused on working with string functions in SQL and understanding how to clean and transform text data. It may look simple, but I realized how powerful string operations are in real-world data analysis. Topics I covered: ✔ CONCAT – combining multiple columns into one ✔ LOWER / UPPER – standardizing text format ✔ LENGTH – measuring text data ✔ TRIM – removing unnecessary spaces ✔ LEFT / RIGHT / SUBSTRING – extracting specific parts of text ✔ REPLACE – modifying values inside strings Example I practiced: SELECT CONCAT(LOWER(first_name), '.', LOWER(last_name), '@gmail.com') AS email FROM employees; Key learning today 💡 Data is often messy, and cleaning it is a crucial step Small transformations can make data more usable and consistent String functions are essential for real-world datasets Every day I’m getting more comfortable thinking in SQL and solving problems step by step. Goal: Become job-ready in SQL & Data Analysis 💪 #SQL #DataAnalytics #LearningInPublic #100DaysOfCode #Consistency
To view or add a comment, sign in
-
-
Week 10 SQL Class and things are getting more interesting. Today we continued our SQL deep dive, covering some of the most important concepts for data analysis: 🔹 ORDER BY — sorting query results to make data readable and ranked 🔹 GROUP BY — grouping rows to perform calculations by category 🔹 Aggregate Functions — SUM, COUNT, AVG, MIN, MAX for summarizing large datasets 🔹 CASE Statements applying conditional logic directly inside a query. What I love about this stage of learning is how everything starts to feel connected. GROUP BY barely makes sense without aggregate functions. CASE statements unlock a whole new layer of flexibility in how you shape your output. Each class is building on the last, and I can feel the foundation getting stronger. If you’re learning SQL too, I’d love to connect. Let’s grow together. 🚀 #SQL #DataAnalytics #LearningInPublic #DataAnalyst #CareerGrowth
To view or add a comment, sign in
-
-
🚀 Day 7 of My SQL Learning Journey Today I learned about CASE WHEN in SQL, a powerful feature used to apply conditional logic inside SQL queries. It works similar to IF–ELSE logic in programming and helps transform raw data into meaningful insights. 📚 Topics Covered: 🔹 CASE WHEN (Conditional Logic) Learned how CASE WHEN is used to show different results based on conditions within a query. 🔹 SUM + CASE WHEN Practiced combining SUM with CASE WHEN to calculate totals for specific conditions, such as total sales for a particular product category. 🔹 COUNT + CASE WHEN Used COUNT with CASE WHEN to count rows that satisfy certain conditions, such as counting pass/fail students or active customers. 🔹 CASE WHEN Syntax Rules Understood that every CASE statement starts with CASE and ends with END, with conditions defined using WHEN and results returned using THEN. 🔹 CASE WHEN with GROUP BY Learned how CASE WHEN can be applied with GROUP BY to perform conditional calculations on grouped data. 🔹 CASE WHEN with WHERE Explored how CASE WHEN can help apply dynamic filtering conditions inside the WHERE clause. 💡 Key Learning: CASE WHEN allows us to add decision-making logic directly inside SQL queries, making it easier to create conditional calculations and customized reports. #SQL #SQLLearning #DataAnalytics #LearningJourney #Database #DataSkills
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