w3resource

AdventureWorks Database: Find all products that have NULL in the weight column

SQL Query - AdventureWorks: Exercise-186 with Solution

186. From the following table write a query in SQL to find all products that have NULL in the weight column. Return name and weight.

Sample table: Production.Product


Click to view Full table

Sample Solution:

SELECT Name, Weight  
FROM Production.Product  
WHERE Weight IS NULL;

Sample Output:

name                           |weight|
-------------------------------+------+
Adjustable Race                |      |
Bearing Ball                   |      |
BB Ball Bearing                |      |
Headset Ball Bearings          |      |
Blade                          |      |
LL Crankarm                    |      |
ML Crankarm                    |      |
HL Crankarm                    |      |
Chainring Bolts                |      |
Chainring Nut                  |      |
Chainring                      |      |
Crown Race                     |      |
Chain Stays                    |      |
Decal 1                        |      |
Decal 2                        |      |
...

SQL AdventureWorks Editor:

Practice Online


Contribute your code and comments through Disqus.

Previous: Null special offers will return MaxQty as zero.
Next: Find the data from the first column that has a non-null value.


What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.

SQL: Tips of the Day

ROW_NUMBER() in MySQL

SELECT t0.col3
FROM table AS t0
LEFT JOIN table AS t1 ON t0.col1=t1.col1 AND t0.col2=t1.col2 AND t1.col3>t0.col3
WHERE t1.col1 IS NULL;

Ref : https://bit.ly/3VX3Jzv