 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
How to create boolean column in MySQL with false as default value?
To create a column with ?false' as the default value, we can use the concept of "default" at the time of creation of the table.
Note − 0 represents false and 1 represents true.
Creating a table using "default" false.
mysql> create table TrueFalseTable -> ( -> Adult boolean default false -> ); Query OK, 0 rows affected (0.65 sec)
Inserting records with no value, since we have set "default" above.
mysql> insert into TrueFalseTable values(); Query OK, 1 row affected (0.16 sec)
To display records.
mysql> select *from TrueFalseTable;
The following output shows that the default is set to Boolean false i.e. 0
+-------+ | Adult | +-------+ | 0 | +-------+ 1 row in set (0.00 sec)
Advertisements
 