WebDevelopersNotes logo

home-icon Home / MySQL / mysql online tutorial – Null column type

mysql online tutorial – Null column type

mysql online tutorial - Null column type

The NULL column type is special in many ways. To insert a NULL value, just leave the column name from the INSERT statement. Columns have NULL as default unless specified by NOT NULL. You can have null values for integers as well as text or binary data.
NULL cannot be compared using arithmetic operators. Comparisons for NULL take place with IS NULL or IS NOT NULL.

select e_id, children
from employee_per
where children IS NOT NULL;

+------+----------+
| e_id | children |
+------+----------+
|    2 |        3 |
|    3 |        2 |
|    7 |        3 |
|    9 |        1 |
|   11 |        4 |
|   12 |        3 |
|   13 |        2 |
|   15 |        3 |
|   16 |        2 |
|   17 |        1 |
|   21 |        2 |
+------+----------+
11 rows in set (0.00 sec)

The above lists ids and no. of children of all employees who have children.

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

How a Computer Engineering student feels, When the PROGRAM Compiles

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

The Apollo 8 astronauts were honoured in 1968 with Time magazine's "Person of the Year". There were three crew members on the spacecraft - William Anders, Frank Borman and Jim Lovell. They became the first humans to travel beyond low Earth orbit and orbit the moon. The Apollo 8 was a monumental achievement for science and technology and set the stage for the first manned moon landings in 1969. [more...]

We use cookies to give you the best possible website experience. By using WebDevelopersNotes.com, you agree to our Privacy Policy