When we run the INSERT INTO statement without giving the columns name/s and values both then MySQL will store NULL as the value of the column/s of table. Consider the example given below in which we have created a table ‘Student’ with the following query −
mysql> Create table Student(RollNO INT, Name Varchar(20), Class Varchar(15)); Query OK, 0 rows affected (0.17 sec)
Now, we can run INSERT INTO statement without giving the columns name/s and values both as follows −
mysql> Insert into Student() Values(); Query OK, 1 row affected (0.02 sec)
We can see from the query below MySQL stores NULL as the values of column.
mysql> Select * from Student; +--------+------+-------+ | RollNO | Name | Class | +--------+------+-------+ | NULL | NULL | NULL | +--------+------+-------+ 1 row in set (0.00 sec)
Every time, we run the INSERT INTO statement without giving the columns name/s and value both, MySQL will store NULL as the value of the column/s of table.
mysql> Insert into Student() Values(); Query OK, 1 row affected (0.03 sec) mysql> Select * from Student; +--------+------+-------+ | RollNO | Name | Class | +--------+------+-------+ | NULL | NULL | NULL | | NULL | NULL | NULL | +--------+------+-------+ 2 rows in set (0.00 sec)