SQL not Null | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

SQL not Null

If a column is set to not null and you write a insert into statement without inserting a value to it, will it ignore the whole statement or will it choose the next smallest value after null like 1? For example our table is students with the columns FName, LName, Age and Age is set to not null. If we do a insert statement like the following: Insert into students(FName, LName) values (John, Doe) what will happen to age or will it even work?

30th Oct 2018, 7:19 AM
Sam
Sam - avatar
1 Answer
+ 1
From: https://www.w3schools.com/sql/sql_notnull.asp "This enforces a field to always contain a value, which means that you cannot insert a new record, or update a record without adding a value to this field." For something a bit more interactive: https://www.techonthenet.com/sql/is_not_null.php
30th Oct 2018, 8:19 AM
Janning⭐
Janning⭐ - avatar