Urgent.News

What's breaking now, across thousands of outlets.

Tech

NULL in SQL: Why = NULL Finds Nothing and What to Write Instead

By Michael Nocito , data analyst · Published August 7, 2026 By the end of this page you can predict what any query does when it meets a missing value, which is the skill that separates "my query returned nothing and I don't know why" from a two-second fix. You will know why = NULL matches zero rows, why one NULL can empty an entire NOT IN , and how NULLs quietly move averages, counts, groups, and…

NULL is a special value in SQL that represents an unknown or missing value. When used in a comparison, such as = NULL, it always returns unknown, which means the row is excluded from the result set. This is why a query like SELECT * FROM tickets WHERE assignee = NULL; returns zero rows, even for tickets with no assignee. To check for NULL values specifically, use the IS NULL operator, like WHERE assignee IS NULL.

This distinction is crucial because NULL does not equal any value, including itself. Understanding this concept helps in predicting query behavior and avoiding unexpected results. For example, the query SELECT COUNT(*) AS n FROM tickets WHERE assignee IS NULL; returns the number of rows with missing assignees, which is the intended result.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Month-over-Month Growth in SQL: LAG, the Growth Formula, and the Traps

By Michael Nocito , data analyst · Published August 7, 2026 By the end of this page you can write a month-over-month growth query and trust its answer.

  • Month-over-month growth calculated using LAG function
  • LAG function fetches previous month's revenue for comparison
  • Three common traps can lead to incorrect growth calculations

How to Find Duplicate Rows in SQL (and Decide What Counts as One)

By Michael Nocito , data analyst · Published August 7, 2026 By the end of this page you can check any table for duplicate rows, list every copy, and mark which one to keep, all with queries you…

  • Decide what defines a duplicate (all columns or specific column)
  • Compare total row count to distinct key count using COUNT() vs COUNT(DISTINCT key)
  • Group rows by duplicate columns, keep groups with COUNT() > 1, mark extras with ROWNUMBER

pandas GroupBy: How to Summarize a DataFrame Without Losing Track of Your Rows

By Michael Nocito , data analyst · Published August 7, 2026 By the end of this page you can take a DataFrame, summarize it by any column or combination of columns, get several statistics at once with…

  • Groupby operation splits DataFrame into mini-tables based on unique values in grouping columns
  • Basic usage: df.groupby(region)[amount].mean() computes mean of 'amount' column for each region
  • Multiple statistics simultaneously using agg and named aggregation for cleaner output

Which SQL Database Should You Install?

By Michael Nocito , data analyst · Published August 7, 2026 If you want to write SQL against your own data today, install a file-based engine: SQLite if you are learning, DuckDB if your data is…

  • File-based databases like SQLite or DuckDB recommended for single-user or small projects
  • Server databases such as PostgreSQL, MySQL, or SQL Server needed for multiple users
  • Choose based on whether simultaneous access to data is required

More from Friday 21 August →