i ma creating a table like -
create table mobile_master(id int AUTO_INCREMENT NOT NULL PRIMARY KEY,property1_name varchar(100) NOT NULL,property2_name varchar(100) NOT NULL,property3_name varchar(100) NOT NULL,property4_name varchar(100) NOT NULL,property5_name varchar(100) NULL,property6_name varchar(100) NULL,property7_name varchar(100) NULL,property8_name varchar(100) NULL,property9_name varchar(100) NULL,property10_name varchar(100) NULL,property11_name varchar(100) NULL,property12_name varchar(100) NULL,property13_name varchar(100) NULL,property14_name varchar(100) NULL,property15_name varchar(100) NULL)engine=INNODB;
but when i insert values with property2_name with no value something like this -
insert into mobile_master (property1_name,property2_name) values ('Brand','Model Number');
query gets accepted ...the NOT NULL factor is not coming into play...
3 2185
You are not inserting NULL, you are inserting an empty value.
MySql will insert the default value for a field that is NOT NULL,
0 for INT, empty for string
is there a way so that i make sure that there is a value in a column ?
Do you mean reject the query if there are missing values?
This is better handled on the front end.
But you could try something weird like, setting the dafault value to NULL yet have the field set to NOT NULL. No idea what would happen then.
Or write a sql function to process the incoming data that so missing data is set to NULL
Can NULLIF() be used with INSERT INTO?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ken |
last post by:
Hi. This is a followup to my NULL macro vs. 0 question. It's in a
separate thread, because I need to post using google, so my original
thread isn't available to me yet :(.
Anyway, I just...
|
by: Jason Curl |
last post by:
I've been reading this newsgroup for some time and now I am thoroughly
confused over what NULL means.
I've read a NULL pointer is zero (or zero typecast as a void pointer),
others say it's...
|
by: moxm |
last post by:
I have a statement declares a globle variable like this :
char *pname = NULL;
Then I used splint to check the code, I got errors:
err.c:8:15: Global pname initialized to null value: pname =...
|
by: David Sworder |
last post by:
Hi,
I've created a UserControl-derived class called MyUserControl that is
able to persist and subsequently reload its state. It exposes two methods as
follows:
public void Serialize(Stream...
|
by: Dan |
last post by:
I'm fairly new to C# and I am having some problems
understanding int variables and null values.
I have created a class that populates the values of it's
fields from a DataReader in it's...
|
by: fieldfallow |
last post by:
Hello all,
Before stating my question, I should mention that I'm fairly new to C.
Now, I attempted a small demo that prints out the values of C's numeric
types, both uninitialised and after...
|
by: valentin tihomirov |
last post by:
As explained in "Using pointers vs. references"
http://groups.google.ee/group/borland.public.delphi.objectpascal/browse_thread/thread/683c30f161fc1e9c/ab294c7b02e8faca#ab294c7b02e8faca ,
the...
|
by: gingawarrior |
last post by:
Hi All,
I've written some code to act as a validator for a set of form fields - it accepts a string of '~' delimited item names and then loops through to evaluate if they are either empty or =='999'...
|
by: Richard Heathfield |
last post by:
In an otherwise excellent article, Eric Sosman said:
<snip>
....or will read it without ever writing it, in which case the
initialisation value protects you against reading an indeterminate...
|
by: Gilles Ganault |
last post by:
Hello
To handle an occasionnal flaky ADSL connection, I updated the
database that handles incoming calls to have a column that is set to
NULL, and then updated to either Y or N depending on...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |