MySQL: Handling null value

This entry is part 11 of 26 in the series Learn MySQL

NULL is not a special character in SQL but it requires special treatment.

In SQL, NULL indicates no values.  It can mean unknown, missing or out of range.

To insert a NULL value into SQL, the NULL value should not have enclosing quotes.

insert into artist (artiste, album, price) values ('Madonna',NULL,8.60)

After inserting, you can see how NULL is presented in Toad client as in the screenshot below.



Take note of the technique to query a record with NULL value.

For our case it is:

select * from artist where album is NULL
Series Navigation<< MySQL: Handling special characters
MySQL: Handling empty string >>