WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

SQL NULL Values


NULL values speak to missing obscure data.

By default, a table section can hold NULL values.

This section will clarify the IS NULL and IS NOT NULL operators.


SQL NULL Values

If a section in a table is discretionary, we can embed another record or refresh a current record without enhancing this segment. This implies that the field will be spared with a NULL value.

NULL values are dealt with uniquely in contrast to other values.

NULL is utilized as a placeholder for obscure or inapplicable values.


SQL Working with NULL Values

Look at the accompanying "Persons" table:

P_Id LastName FirstName City
1 Hansen Ola Sandnes
2 Svendson Tove Sandnes
3 Pettersen Kari  

Suppose that the "Address" section in the "Persons" table is discretionary. This implies in the event that we embed a record with no an incentive for the "Address" section, the "Address" segment will be spared with a NULL value.

How would we be able to test for NULL values?

It is beyond the realm of imagination to expect to test for NULL qualities with examination administrators, for example, =, <, or <>.

We should utilize the IS NULL and IS NOT NULL administrators instead.


SQL IS NULL

How do we select just the records with NULL qualities in the "Address" column?

We should utilize the IS NULL operator:

SELECT LastName,FirstName,Address FROM Persons
WHERE Address IS NULL

The result-set will look like this:

LastName FirstName Address
Hansen Ola  
Pettersen Kari  

SQL IS NOT NULL

How do we select just the records with no NULL qualities in the "Address" column?

We should utilize the IS NOT NULL operator:

SELECT LastName,FirstName,Address FROM Persons
WHERE Address IS NOT NULL

The result-set will look like this:

LastName FirstName Address
Svendson Tove Borgvn 23

In the following part we will take a gander at the ISNULL(), NVL(), IFNULL() and COALESCE() functions.