MySQL Basics Practice Test: Null — Flashcards | Databases | FatSkills

MySQL Basics Practice Test: Null — Flashcards

Fast review mode: answers are shown by default so you can skim quickly. Hide them if you want to self-test.

In MySQL, the NULL value represents "no data" or "a missing unknown value". It is different from an empty string, which represents a value for string types, and 0, which represents a value for numeric types. NULL can be written in any lettercase, and for example, \N is a synonym for NULL. 

To test for NULL, you can use the IS NULL and IS NOT NULL operators. For example, you can use the following query: 
mysql> SELECT 1 IS NULL, 1 IS NOT NULL; 
 
You can't use arithmetic comparison operators like = or <. In MySQL, 0 or NULL means false and anything else means true. For example, if you run the query select null = null, you'll get null back as the result. 
To represent null values in your queries, you can use the ifnull statement. This statement checks if a value is null and replaces it with a specified value if it is. 

1 of 10 Ready
What is the meaning of “NULL” in Mysql?
All of these
Shortcuts
Prev Space Show / hide Next
Turn this into a study set.
Sign in with Google to save tricky questions to your reminder list and resume on any device.
Sign in with Google Free • no extra password