Field 'BIOMETRIC_FLAG' doesn't have a default value

Hi,
i am trying to insert data into a table but i am getting this error.
Field 'BIOMETRIC_FLAG' doesn't have a default value
INSERT INTO mytab (CLIENT_ID,DAD_ID,LOCATION,DESCRIPTION) VALUES (1,1,'Default','First Data Acquisition Device');
where 'BIOMETRIC_FLAG'  is a field in the table and it is defined in the table as
BIOMETRIC_FLAG                CHAR(1)                           NULL
please help me in resolvin this error.
rgds,
vijji
vijji_lakshmiAsked:
Who is Participating?
 
UmeshConnect With a Mentor MySQL Principle Technical Support EngineerCommented:
This works..


CREATE TABLE `mytab` (
  `CLIENT_ID` int(11) NOT NULL,
  `DAD_ID` int(11) NOT NULL,
  `LOCATION` varchar(20) DEFAULT NULL,
  `DESCRIPTION` varchar(40) DEFAULT NULL,
  `NAME` varchar(20) DEFAULT NULL,
  `CONNECTION_TYPE` int(11) DEFAULT NULL,
  `PRIMARY_ADDRESS` varchar(50) DEFAULT NULL,
  `SECONDARY_ADDRESS` varchar(50) DEFAULT NULL,
  `TERTIARY_ADDRESS` varchar(50) DEFAULT NULL,
  `BIOMETRIC_FLAG` char(1),
  `TIME_ZONE` varchar(50) DEFAULT NULL,
  `DAYLIGHT` char(1)
)
 
INSERT INTO mytab (CLIENT_ID,DAD_ID,LOCATION,DESCRIPTION) VALUES (1,1,'Default','First Data Acquisition Device');
 
 
SELECT * from mytab;
 
1		1		Default		First Data Acquisition Device		\N		\N		\N		

Open in new window

0
 
UmeshMySQL Principle Technical Support EngineerCommented:
You provided values for 4 columns. But column 'BIOMETRIC_FLAG' MUST be filled in because you have no default set for it. Otherwise what is MySQL supposed to fill 'BIOMETRIC_FLAG' with?

Please post the output of below..

desc mytab;
0
 
vijji_lakshmiAuthor Commented:
Hi, i mentioned in table def that BIOMETRIC_FLAG  can be null.
if i don't supply any thing i suppose it should keep null or blank.
any way ia have provided deble strusture below.
please let me know the solution.

+-------------------+-------------+------+-----+---------+-------+
| Field             | Type        | Null | Key | Default | Extra |
+-------------------+-------------+------+-----+---------+-------+
| CLIENT_ID         | int(11)     | NO   |     |         |       |
| DAD_ID            | int(11)     | NO   |     |         |       |
| LOCATION          | varchar(20) | YES  |     | NULL    |       |
| DESCRIPTION       | varchar(40) | YES  |     | NULL    |       |
| NAME              | varchar(20) | YES  |     | NULL    |       |
| CONNECTION_TYPE   | int(11)     | YES  |     | NULL    |       |
| PRIMARY_ADDRESS   | varchar(50) | YES  |     | NULL    |       |
| SECONDARY_ADDRESS | varchar(50) | YES  |     | NULL    |       |
| TERTIARY_ADDRESS  | varchar(50) | YES  |     | NULL    |       |
| BIOMETRIC_FLAG    | char(1)     | YES  |     | NULL    |       |
| TIME_ZONE         | varchar(50) | YES  |     | NULL    |       |
| DAYLIGHT          | char(1)     | YES  |     | NULL    |       |
+-------------------+-------------+------+-----+---------+-------+
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
UmeshMySQL Principle Technical Support EngineerCommented:
Pls send this..

show create table mytab;

and

show variables like 'sql_mode';
0
 
vijji_lakshmiAuthor Commented:
| dad_m | CREATE TABLE `mytab` (
  `CLIENT_ID` int(11) NOT NULL,
  `ID` int(11) NOT NULL,
  `LOCATION` varchar(20) DEFAULT NULL,
  `DESCRIPTION` varchar(40) DEFAULT NULL,
  `NAME` varchar(20) DEFAULT NULL,
  `CONNECTION_TYPE` int(11) DEFAULT NULL,
  `PRIMARY_ADDRESS` varchar(50) DEFAULT NUL
  `SECONDARY_ADDRESS` varchar(50) DEFAULT N
  `TERTIARY_ADDRESS` varchar(50) DEFAULT NU
  `BIOMETRIC_FLAG` char(1),
  `TIME_ZONE` varchar(50) DEFAULT NULL,
  `DAYLIGHT` char(1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
0
 
vijji_lakshmiAuthor Commented:
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| sql_mode      |       |
+---------------+-------+
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.