
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Insert Null Value into Database Field with CHAR(2) as Type in MySQL
Let us first create a table −
mysql> create table DemoTable658(FirstName varchar(100),value char(2)); Query OK, 0 rows affected (0.95 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable658(FirstName) values('John') ; Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable658(value,FirstName) values(default(value),'Sam'); Query OK, 1 row affected (0.23 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable658;
This will produce the following output −
+-----------+-------+ | FirstName | value | +-----------+-------+ | John | NULL | | Sam | NULL | +-----------+-------+ 2 rows in set (0.00 sec)
Advertisements