Mysql online tutorial - null column type - mysql column type - null and not null mysql
mysql online tutorial, null column type, mysql column type, null and not null mysql
mysql online tutorial - Null column typeGo to mysql online tutorial - Null column typeSQL tutorialGo to SQL tutorialWeb development tutorialsGo to web development tutorialsHomepage

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 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.



Assignments
  1. Find and list the ids and spouse names of all employees who are married.
  2. Change the above so that the display is sorted on spouse names.
  3. How many employees do we have under each sex (male and female)?
  4. How many of our employees are married and unmarried?
  5. Find the total number of children.
  6. Make unique groups of children and find the number in each group. Sort the display with the group having maximum children, at the top.
   Click here for possible answers


Back Next


AddThis Social Bookmark Button
Page contents: Mysql online tutorial - null column type - mysql column type - null and not null mysql

Page URL: http://www.webdevelopersnotes.com/tutorials/sql/ mysql_online_tutorial_null_column_type.php3



Join Mailing List


Feedback/Questions




50+ web hosting FAQs

Search engine for your website

Free software from Google - The Google Pack Collection

Create your own search engine
Search WebDevelopersNotes.com