MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
1PLs Company - #1Payday.Loans Agency - Loans online and near me $100-$2500 (Same Day)
Powered by MySQL
 
Home / Errors / Question No: 132

1048 Column cannot be null

I am getting the MySQL error #1048 - Column 'min' cannot be null when I try to run my insert query. This is my query:

INSERT INTO sys_data
SET sys_userid = '1', sys_groupid = '0',
`origin` = 'admin',`serial` = '200804088',
`min = NULL,`max = NULL,`active` = 'Y';

In response the MySQL returns below error:

#1048 - Column 'min' cannot be null

Any guidance please!

Answer No: 132

The error #1048 mostly occurs when INSERT query makes try to insert NULL values into a NOT NULL field. I assume that 'min' is a NOT NULL field in your table against which you are inserting NULL value. So you may replace NULL and instead give 0 (if the field is numeric type) to get rid of this error like below:

INSERT INTO sys_data
SET sys_userid = '1', sys_groupid = '0',
`origin` = 'admin',`serial` = '200804088',
`min = 0,`max = NULL,`active` = 'Y';

Related MySQL FAQs to the Above FAQ

Why-I-see-an-error-when-I-EXPLAIN-for-update-query Why I see an error when I EXPLAIN for update query?

ERROR-1295-(HY000):-This-command-is-not-supported-in-the-prepared-statement-protocol-yet ERROR 1295 (HY000): This command is not supported in the prepared statement protocol yet

ERROR-1064-(42000):-You-have-an-error-in-your-SQL-syntax ERROR 1064 (42000): You have an error in your SQL syntax

1264-Out-of-range-value-adjusted-for-column 1264 Out of range value adjusted for column

1093-You-can-not-specify-target-table-comments-for-update-in-FROM-clause 1093 You can not specify target table comments for update in FROM clause

1191-Cant-find-FULLTEXT-index-matching-the-column-list 1191-Cant find FULLTEXT index matching the column list

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: Wikipedia.org | Oracle.com | w3schools.com | www.php.net | Github.com

© 2023  www.mysqlfaqs.net
All rights reserved.