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 arithemetic operators. Comparisions 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.
|
« Previous
|
Next »
|
MySQL tables Now that we've created our employee_data table, let's check its listing. Type SHOW TABLES; at the mysql prompt. This should present you with ...
MySQL Date column type part 1 Till now we've dealt with text (varchar) and numbers (int) data types. To understand date type, we'll create one ...
Creating tables In this section of the mysql training course we will explore the MySQL commands to create database tables and selecting the database. Databases ...
Column Types part 2 MySQL Text data type Text can be fixed length (char) or variable length strings. Also, text comparisions can be case sensitive ...
Inserting data in MySQL tables Inserting data into tables The INSERT SQL statement impregnates our table with data. Here is a general form of INSERT. ...