Free tools Windows power users keep installed
One-click scans. No signup required.
NULL means a value is missing, unknown, or inapplicable—not zero and not an empty string. To find it, use IS NULL, not = NULL. Once you understand that a comparison with NULL can evaluate to UNKNOWN, SQL’s filtering, logic, and aggregate behavior becomes easier to predict.
How do you check for NULL in SQL?
Use IS NULL to find rows with a null value and IS NOT NULL to find rows with a known value. Do not use = NULL or <> NULL: comparisons with NULL do not produce TRUE or FALSE in the ordinary way.
-- Incorrect: this comparison does not evaluate to TRUE for NULL values
SELECT * FROM customers WHERE middle_name = NULL;
-- Correct: test whether the value is null
SELECT * FROM customers WHERE middle_name IS NULL;
Microsoft’s Transact-SQL documentation puts the distinction plainly: “A null value is different from an empty or zero value.” A blank string can be a known value; NULL indicates that the value itself is not known or does not apply. See Microsoft’s SQL Server explanation of NULL and UNKNOWN and the MySQL manual’s discussion of NULL.
Why doesn’t = NULL work?
SQL treats NULL as an unknown state rather than a normal value that can be compared. A comparison such as NULL = NULL therefore evaluates to UNKNOWN, not TRUE. A comparison with NULL does not establish that the two values match, even when both sides are NULL. Null testing is a separate operation, expressed with IS NULL or IS NOT NULL.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
What does UNKNOWN do in a WHERE clause?
SQL predicates can evaluate to TRUE, FALSE, or UNKNOWN. A WHERE clause retains rows for which its condition is TRUE; rows whose condition is FALSE or UNKNOWN are not returned. This explains why a seemingly straightforward inequality can exclude records with missing values.
-- Rows with a NULL status do not pass this condition
SELECT * FROM orders
WHERE status <> 'closed';
If the intended result includes orders whose status is missing, state that explicitly:
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
SELECT * FROM orders
WHERE status <> 'closed' OR status IS NULL;
The right condition depends on what the result is meant to include. Replacing NULL with an empty string just to make a comparison work can change the meaning if an empty string is a legitimate status.
NOT does not turn UNKNOWN into TRUE
Negating an unknown comparison still gives UNKNOWN. For example, NOT (status = 'closed') does not bring NULL statuses into the results: those rows still fail the WHERE filter. PostgreSQL 16 documents the truth behavior of AND, OR, and NOT in its logical operators reference.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
When should you use COALESCE or NULLIF?
These functions address different needs. COALESCE chooses a fallback for an expression; NULLIF turns a chosen value into NULL when it matches another value. Neither function makes the underlying data’s meaning irrelevant: use a fallback or sentinel only when it fits the data’s semantics.
| Purpose | Expression | Effect |
|---|---|---|
| Test for a missing value | column IS NULL / column IS NOT NULL |
Checks null state without replacing it. |
| Choose a fallback for output | COALESCE(a, b, fallback) |
Returns the first non-NULL argument; does not update stored data. |
| Normalize a known sentinel | NULLIF(value, sentinel) |
Returns NULL when the two arguments compare equal. |
Use COALESCE for a meaningful fallback
COALESCE returns the first non-NULL argument. For example, this PostgreSQL-compatible expression uses a nickname when present, otherwise the full name, and finally a display label:
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
SELECT COALESCE(nickname, full_name, '(unnamed)') AS display_name
FROM people;
This is a query-time result, not a change to the stored columns. PostgreSQL requires the arguments to be convertible to a common type; consult the PostgreSQL conditional expressions documentation for its rules and evaluation details.
Do not automatically write COALESCE(amount, 0). Zero may mean a measured amount of zero, while NULL may mean “not recorded.” Substitution can alter comparisons and reported calculations, so choose zero only if it is the intended interpretation.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsBest Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Use NULLIF only when the sentinel really means “no value”
NULLIF(a, b) returns NULL when its arguments compare equal; otherwise, it returns the first argument. If an application has deliberately used an empty string to mean “no discount code,” you can normalize that representation:
SELECT NULLIF(discount_code, '') AS discount_code
FROM orders;
This does not mean empty strings are inherently NULL. Keep them distinct when an empty string is a valid, meaningful value.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.How do NULLs affect counts, groups, and sorting?
These details can be engine-specific. In the MySQL 26.7 manual, aggregate functions generally ignore NULL inputs, COUNT(*) counts rows, and COUNT(column) counts non-NULL values in that column. MySQL also treats NULL values as equal for DISTINCT and GROUP BY; its default ordering places NULL first in ascending order and last in descending order. Verify behavior and syntax in the documentation for your database engine.
| MySQL expression or clause | What it counts or does |
|---|---|
COUNT(*) |
Counts rows, including rows with NULL values. |
COUNT(column) |
Counts non-NULL values in that column. |
GROUP BY column |
Groups NULL values together. |
ORDER BY column |
Places NULL first by default; descending order places it last. |
For the product-specific details, see MySQL: Problems with NULL Values.
Are COALESCE and ISNULL interchangeable in SQL Server?
No. In SQL Server, ISNULL takes two arguments, while COALESCE accepts a list. Microsoft also documents differences in result type precedence, nullability metadata, and evaluation: COALESCE is rewritten like a CASE expression, and its input expressions may be evaluated more than once. A subquery argument can therefore be evaluated twice. These differences can matter in computed columns, constraints, and expressions involving nondeterministic inputs. Check Microsoft’s SQL Server COALESCE documentation before choosing between them.
Quick Recap
A practical NULL-handling checklist
- Use
IS NULLorIS NOT NULLto test for NULL; do not compare with= NULLor<> NULL. - Decide whether rows with missing values should be excluded or explicitly included in each filter.
- Use
COALESCEonly when its fallback has the intended meaning, and useNULLIFonly for a sentinel that truly represents no value. - Check your database engine’s documentation for aggregate, ordering, grouping, and function-specific behavior.
- Test the query against representative rows containing NULL, empty strings, and meaningful zero values.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

