Data Driven Insights

Data Driven Insights "Unlock the power of data! 📊 From Excel tricks to SQL queries and Python automation—master the skills that drive insights.
(5)

Follow for tips, tutorials, and more! "

https://linktr.ee/datadriveninsights

21/08/2026

Window functions let you calculate across related rows without collapsing the result set.

Use PARTITION BY to define the group, ORDER BY to control the sequence, and a ROWS frame for reliable running totals.

Save this SQL reference.

Bucket Sort made simple.Learn how Bucket Sort distributes values into ranges, sorts each bucket, and combines them to pr...
21/08/2026

Bucket Sort made simple.

Learn how Bucket Sort distributes values into ranges, sorts each bucket, and combines them to produce the final sorted result. It works especially well when data is reasonably evenly distributed across the buckets.

Save this for later!

How would you optimize a slow SQL query? — the question where the difference between a junior and senior answer isn't th...
21/08/2026

How would you optimize a slow SQL query? — the question where the difference between a junior and senior answer isn't the terms you know, it's how precisely you use them.

Swipe through the full breakdown: what to actually check in an ex*****on plan (actual rows vs. estimated, warning icons, cost as a starting estimate — not a literal runtime breakdown), SARGability beyond the classic YEAR() example — including the implicit varchar/nvarchar conversion trap most people never think to check, why a seek with a Key Lookup still isn't automatically fast, why row-count mismatches point to cardinality estimation problems more broadly (not just stale statistics), and the parameter sniffing pattern that makes a query fast for one user and inexplicably slow for the next — including when to actually reach for OPTION(RECOMPILE) or OPTIMIZE FOR UNKNOWN, and when not to.

Want more like this? Subscribe for future deep dives. 🔔

How would you optimize a slow SQL query? — the question that separates people who know syntax from people who actually u...
21/08/2026

How would you optimize a slow SQL query? — the question that separates people who know syntax from people who actually understand how SQL Server decides to run a query.

This image covers the diagnostic-first approach interviewers actually want to hear: start with the real ex*****on plan, not guesswork. Then a practical 5-point checklist — reading scans vs. seeks correctly (a scan isn't automatically wrong), keeping predicates SARGable, selecting only the columns you need, keeping statistics current, and watching for parameter sniffing, the SQL Server–specific gotcha that makes a query fast for one user and slow for the next with zero code changes.

Also included: the single most common way developers accidentally disable an index without realizing it — wrapping an indexed column in a function like YEAR(...) — with the exact rewrite that fixes it.

Want the full breakdown? Subscribe for the deep-dive carousel — the edge cases, the mistakes, and the follow-up questions interviewers actually ask next. 🔔

Cardinality Estimation in SQLCardinality estimates help the optimiser predict row counts at different stages of a query ...
20/08/2026

Cardinality Estimation in SQL

Cardinality estimates help the optimiser predict row counts at different stages of a query and choose a cost-effective ex*****on plan. Compare estimated vs actual rows to spot potential performance problems.

Save this for your SQL reference.

📁 Reading CSV Files in Python — The Clean & Reliable WayWorking with CSV files is one of the most common tasks in data a...
20/08/2026

📁 Reading CSV Files in Python — The Clean & Reliable Way

Working with CSV files is one of the most common tasks in data analysis and automation. Instead of manually splitting lines or risking messy parsing, Python gives us a beautifully simple approach using csv.DictReader — turning each row into a neat dictionary.

In this snippet, you’ll learn how to:

✨ Safely open CSV files with proper encoding
✨ Automatically map columns to values using headers
✨ Yield each row as a dictionary for easy processing
✨ Validate files that are missing headers
✨ Keep your code clean, reusable, and production-ready

This is perfect for:
✔ Data cleaning & preprocessing
✔ ETL pipelines
✔ Analytics workflows
✔ Automation scripts
✔ Any task where structured CSV data matters

Python makes working with data incredibly smooth — and mastering small utilities like this gives you a huge boost in productivity.

Write a query to pivot data in SQL. — the question with a right answer that most people get 90% right and one detail wro...
20/08/2026

Write a query to pivot data in SQL. — the question with a right answer that most people get 90% right and one detail wrong.

Swipe through the full breakdown: the PIVOT operator's three moving parts, the grouping trap that fails without ever throwing an error (leave one extra column in your source query and PIVOT silently produces the wrong shape of result), the portable conditional-aggregation alternative that works across most SQL dialects, and how to build a dynamic pivot when you don't know the column values in advance — including the deterministic-ordering detail most examples skip.

Every claim in this carousel checked against Microsoft's documentation and cross-referenced across multiple sources, including the parts that are easy to get subtly wrong: PIVOT is vendor-specific syntax, not part of standard SQL, and STRING_AGG needs an explicit WITHIN GROUP (ORDER BY ...) or your column order isn't guaranteed.

Want more like this? Subscribe for future deep dives. 🔔

20/08/2026

Semi-joins and anti-joins made simple.

Use EXISTS when you need rows that have related records. Use NOT EXISTS when you need rows with no related records. A clean way to filter without pulling extra joined columns.

Save this SQL reference.

Radix Sort made simple.Learn how L*D Radix Sort processes numbers one digit at a time—from ones to tens to hundreds—usin...
20/08/2026

Radix Sort made simple.

Learn how L*D Radix Sort processes numbers one digit at a time—from ones to tens to hundreds—using a stable sort at each pass. Efficient for suitable integer data without directly comparing values.

Save this for later!

What is a recursive CTE? — the follow-up question that separates people who memorized the anchor/recursive-member defini...
20/08/2026

What is a recursive CTE? — the follow-up question that separates people who memorized the anchor/recursive-member definition from people who've actually debugged one.

Swipe through the full breakdown: the anatomy explained with a fresh category-tree example, the two classic use cases (hierarchies vs. sequences) and how the recursive member differs between them, the column-matching rule that trips people up in practice — anchor and recursive character columns need matching data types and length, not just matching types, so cast both to something like VARCHAR(500) from the start — and exactly when SQL Server's default 100-level MAXRECURSION cap actually becomes a problem.

Also covered: the specific restrictions inside the recursive member — no LEFT/RIGHT/FULL OUTER JOIN, no DISTINCT/GROUP BY/HAVING/TOP/scalar aggregates/subqueries, one reference to the CTE name, and UNION ALL only between the anchor and recursive member — checked directly against Microsoft's documentation.

Want more like this? Subscribe for future deep dives. 🔔

Address

London

Website

Alerts

Be the first to know and let us send you an email when Data Driven Insights posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Shortcuts

Share