General Note: Here we have pulled in the data from a sample database. You can download it from the following link and use it for practicing Click Here For Sample Database

In this tutorial, you will learn what is NULL  and how to handle them in SQLite.

NULL is a value. There is a basic assumption that null denotes infinity or zero or blank space. But it is not true. Null is a value like other, but its undefined. In cmd mode null will be displayed as empty column but in GUI tools it will show NULL as its value. So NULL is a value(Unique value). NULL is equal to NULL, so do not compare NULL with other constant values.

Here discount column has more null values. They are displayed as empty field here but do not consider that as blank.


Select mobile_name,price,discount from mobile_sales_details

mobile_name             price       discount  
----------------------  ----------  ----------
Moto X (16 GB) (Black)  23999                 
Moto G (Black  with 16  13999                 
Moto E (Black)          6999                  
Asus Zenfone 4 A400CG   5999                  
Asus Zenfone 5 A501CG   9999                  
Asus Zenfone 5 A501CG   12999                 
Asus Zenfone 6 A600CG   16999                 
Alcatel Onetouch Idol   16999                 
Samsung Galaxy S Duos   8206                  
Samsung Galaxy Star Pr  7599        23        
Samsung Galaxy S Duos   8214                  
Samsung Galaxy Core I8  11795                 
Samsung Galaxy Grand 2  18990                 
Samsung Galaxy Trend S  9610        28        
Samsung Galaxy Grand N  14010                 
Samsung I8552 - Galaxy  15999                 
Samsung Galaxy S4 Mini  24730       26        
Samsung GT 1200 R/I/M   1299        17        
Samsung Guru 1200 (Bla  1399        9         
Samsung Galaxy S5 (Cha  54300       30        
Samsung Galaxy S4 I950  28071                 
Samsung Guru E1207T (B  1450        0.99

Suppose if you do any arithmetic operation on NULL column the result is always NULL.

Here just add 200 to discount column. See the result


Select discount, discount+200 from mobile_sales_details

discount    discount+200
----------  ------------
                        
                        
                        
                        
                        
                        
                        
                        
                        
23          223         
                        
                        
                        
28          228         
                        
                        
26          226         
17          217         
9           209         
30          230

If you observe the result rows, which had null remains the same even after adding 200 to it.