Summary
Keywords
Full Transcript
A database value may be NULL, which means that it’s either missing, unknown, or just does not apply. NULL is not equivalent to blank for text, or 0 for numerical data types. Some database table columns should should not be NULL, such as an ID column which represents a unique identifier for that row of data. When creating a table, you can prevent NULL values by specifying a column is NOT NULL. This causes the database to reject when a row is inserted with missing data in any column that is set to NOT NULL. When you are using arithmetic operators, such as + - * /, or comparison operators and you have one or more NULL values, the result ends up being NULL. In a SQL query, you can the IS NULL condition to select rows with NULLs. Ex: SELECT Name FROM Friends WHERE Phone IS NULL; SQL also has built-in aggregate functions such as SUM, MAX, MIN, and AVG. They all ignore NULL values when they are used. For example, if you were calculating the Max of numbers, it would ignore the number that is NULL before returning the result. Boolean values are represented as 0 in the database for FALSE, or 1 for TRUE. Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
