Re: Update Column in table only if variable is Not NULL

2013-10-30 Thread Shawn Green
Hi Neil, On 10/30/2013 9:55 AM, Neil Tompkins wrote: Shawn What I need is that if I pass say 10 parameters/variables to a query, I only want to update the column/field if the value passed is NOT NULL. On Wed, Oct 30, 2013 at 3:41 AM, Shawn Green wrote: Hi, On 10/29/2013 9:52 PM, h

Re: Update Column in table only if variable is Not NULL

2013-10-30 Thread Neil Tompkins
Shawn What I need is that if I pass say 10 parameters/variables to a query, I only want to update the column/field if the value passed is NOT NULL. On Wed, Oct 30, 2013 at 3:41 AM, Shawn Green wrote: > Hi, > > On 10/29/2013 9:52 PM, h...@tbbs.net wrote: > >> 2013/10/29

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread Shawn Green
ut if MyVariable is NULL, FieldName1 reflects the attempt to change, not change. The way I understood the second explanation was like this. He wants to update a row of data. The FieldName1 field is always updated to the current date and time. If any of the new values (passed in via variables

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread hsv
2013/10/29 11:35 -0400, Shawn Green My favorite technique is the COALESCE function for this on a column-by-column basis SET FieldName1 = Now(), FieldName2 = COALESCE(:MyVariable, FieldName2) but if MyVariable is NULL, FieldName1 reflects the attempt to change, not change. -

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread hsv
>>>> 2013/10/28 21:23 +, Neil Tompkins >>>> Basically the snippet of the UPDATE statement I provided shows updating only 1 field. However in my live working example, I have about 20 possible fields that "might" need to be updated if the variable

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread Shawn Green
that "might" need to be updated if the variable passed for each field is NOT NULL. Therefore, I felt this needs to be done at database level in the stored procedure. How can I accomplish this. Thanks Neil On Mon, Oct 28, 2013 at 6:17 PM, Shawn Green mailto:shawn.l.gr...@oracle.com>&

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread Michael Dykman
nippet of the UPDATE statement I provided shows updating only 1 field. > However in my live working example, I have about 20 possible fields that > "might" need to be updated if the variable passed for each field is NOT > NULL. > > Therefore, I felt this needs to be done at databa

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Neil Tompkins
passed for each field is NOT NULL. Therefore, I felt this needs to be done at database level in the stored procedure. How can I accomplish this. Thanks Neil On Mon, Oct 28, 2013 at 6:17 PM, Shawn Green wrote: > Hello Neil, > > On 10/28/2013 2:06 PM, Neil Tompkins wrote: > >> Hi &

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Andy Wallace
Try: update my_table set fieldname1 = Now(), Fieldname2 = :myVariable where Fieldname3 is not null On 10/28/13 11:06 AM, Neil Tompkins wrote: Hi If I have a update statement like UPDATE MY_TABLE SET FieldName1 = Now(), FieldName2 = :MyVariable WHERE FieldName3 = 'Y' How can I o

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Shawn Green
Hello Neil, On 10/28/2013 2:06 PM, Neil Tompkins wrote: Hi If I have a update statement like UPDATE MY_TABLE SET FieldName1 = Now(), FieldName2 = :MyVariable WHERE FieldName3 = 'Y' How can I only update the FieldName2 field if the value of MyVariable is NOT NULL ? Thanks Neil

Update Column in table only if variable is Not NULL

2013-10-28 Thread Neil Tompkins
Hi If I have a update statement like UPDATE MY_TABLE SET FieldName1 = Now(), FieldName2 = :MyVariable WHERE FieldName3 = 'Y' How can I only update the FieldName2 field if the value of MyVariable is NOT NULL ? Thanks Neil

Re: Recent change in behaviour when inserting into NOT NULL fields??

2008-04-07 Thread Ed W
Baron Schwartz wrote: Hi Ed, On Thu, Apr 3, 2008 at 3:32 PM, Ed W <[EMAIL PROTECTED]> wrote: Hi Up until version 5.0.44 (on linux) it appeared that you could do stuff like deliberately insert a NULL into a NOT NULL varchar field and it would be silently converted to an empty

Re: Recent change in behaviour when inserting into NOT NULL fields??

2008-04-06 Thread Baron Schwartz
Hi Ed, On Thu, Apr 3, 2008 at 3:32 PM, Ed W <[EMAIL PROTECTED]> wrote: > Hi > > Up until version 5.0.44 (on linux) it appeared that you could do stuff like > deliberately insert a NULL into a NOT NULL varchar field and it would be > silently converted to an empty string. Si

Recent change in behaviour when inserting into NOT NULL fields??

2008-04-03 Thread Ed W
Hi Up until version 5.0.44 (on linux) it appeared that you could do stuff like deliberately insert a NULL into a NOT NULL varchar field and it would be silently converted to an empty string. Similarly if you didn't specify a value it appeared to use what is describe in the docs a

Re: NOT NULL = Not Working?

2007-05-09 Thread Scott Baker
>>> >>> DROP TABLE IF EXISTS foo; >>> >>> CREATE TABLE foo ( >>>ID INTEGER PRIMARY KEY AUTO_INCREMENT, >>>First VarChar(30), >>>Last VarChar(30) NOT NULL, >>>Zip INTEGER >>> ); >>> >&g

Re: NOT NULL = Not Working?

2007-05-09 Thread JamesDR
>> make it NOT assume that? If Last is not specified it should reject that >> command. Is that possible? >> >> --- >> >> DROP TABLE IF EXISTS foo; >> >> CREATE TABLE foo ( >> ID IN

Re: NOT NULL = Not Working?

2007-05-09 Thread Ricardo Conrado Serafim
ot specified it should reject that command. Is that possible? --- DROP TABLE IF EXISTS foo; CREATE TABLE foo ( ID INTEGER PRIMARY KEY AUTO_INCREMENT, First VarChar(30), Last VarChar(30) NOT NULL, Zip INTEGER ); INSERT INTO foo (F

Re: NOT NULL = Not Working?

2007-05-09 Thread JamesDR
If Last is not specified it should reject that > command. Is that possible? > > --- > > DROP TABLE IF EXISTS foo; > > CREATE TABLE foo ( >ID INTEGER PRIMARY KEY AUTO_INCREMENT, >First VarChar

NOT NULL = Not Working?

2007-05-09 Thread Scott Baker
ct that command. Is that possible? --- DROP TABLE IF EXISTS foo; CREATE TABLE foo ( ID INTEGER PRIMARY KEY AUTO_INCREMENT, First VarChar(30), Last VarChar(30) NOT NULL, Zip INTEGER ); INSERT INTO foo (First, Last, Zip)

Re: NOT EMPTY, like NOT NULL

2007-02-13 Thread js
Hello Nils and Jerry, Thanks you for your quick reply! IMO, using trigger looks cleaner and prettier than Excel-like if(char_length) hack so I will probably give triggers a try. Searching on the net, I found some articles on check constraints in MySQL. http://gilfster.blogspot.com/2005/11/check

Re: NOT EMPTY, like NOT NULL

2007-02-12 Thread Nils Meyer
Hi Js, js wrote: Is there any easy way to implement 'NOT EMPTY' constraint? There currently is no support for CHECK Constraints in MySQL, at least to my knowing. So you'd have to go with a trigger. regards Nils -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

RE: NOT EMPTY, like NOT NULL

2007-02-12 Thread Jerry Schwartz
rds, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 > -Original Message- > From: js [mailto:[EMAIL PROTECTED] > Sent: Monday, February 12, 2007 11:09 AM > To: Rolando Edwards > Cc: mysql@lists.mysql.com

Re: NOT EMPTY, like NOT NULL

2007-02-12 Thread js
the table like below. ## mysql> create table t (a char(10) not null); create table t (a char(10) not null); Query OK, 0 rows affected (0.07 sec) mysql> insert into t values(NULL); insert into t values(NULL); ERROR 1048 (23000): Column 'a' cannot be null ######

Re: NOT EMPTY, like NOT NULL

2007-02-12 Thread C.R.Vegelin
Have a look at the HAVING clause ... - Original Message - From: "js " <[EMAIL PROTECTED]> To: Sent: Monday, February 12, 2007 2:48 PM Subject: NOT EMPTY, like NOT NULL Hi list, A silly question. Is it possible to prevent empty value('') from appearing in

Re: NOT EMPTY, like NOT NULL

2007-02-12 Thread Rolando Edwards
ldname='','Empty Value of Your Choice',fieldname)) FROM Give it a try, it's Worth a Shot !!! - Original Message - From: "js" <[EMAIL PROTECTED]> To: mysql@lists.mysql.com Sent: Monday, February 12, 2007 9:48:28 AM (GMT-0500) US/Eastern Subject: NOT EMPT

NOT EMPTY, like NOT NULL

2007-02-12 Thread js
Hi list, A silly question. Is it possible to prevent empty value('') from appearing in a field? I can solve this by using subquery or trigger, but it's a little bit painful. The simpler the better :) Thanks. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsub

Re: timestamp & not null

2006-04-10 Thread Martijn Tonies
> I need to create a "commands" table. A program will periodically check on this table whether > there's a pending command for it to execute or not. Whatever the reason, this program might read a command but not acknowledge it's > execution. > Other program will check out whether the command t

Re: timestamp & not null

2006-04-10 Thread [EMAIL PROTECTED]
10/04/2006 11:51 Para: <[EMAIL PROTECTED]>, Asunto: Re: timestamp & not null Hi, > I created a table and, into it, a timestamp field: > ... EXPIRES TIMESTAMP NOT NULL, ... > > When I issue the command "describe" it shows the field "expires" allows nul

Re: timestamp & not null

2006-04-10 Thread Martijn Tonies
Hi, > I created a table and, into it, a timestamp field: > ... EXPIRES TIMESTAMP NOT NULL, ... > > When I issue the command "describe" it shows the field "expires" allows nulls and defaults to CURRENT_TIMESTAMP. Also, each time I update > a field other than &quo

timestamp & not null

2006-04-10 Thread [EMAIL PROTECTED]
Hi! I created a table and, into it, a timestamp field: ... EXPIRES TIMESTAMP NOT NULL, ... When I issue the command "describe" it shows the field "expires" allows nulls and defaults to CURRENT_TIMESTAMP. Also, each time I update a field other than "expires"

Re: NULL or NOT NULL in relational design

2006-01-23 Thread SGreen
Danny Stolle <[EMAIL PROTECTED]> wrote on 01/23/2006 01:34:01 PM: > Hi, > > I am often running into this type of design, but would it be a good > design. Normally you design tables related to each other and having e.g. > parameter tables like a country-table holding country names with their >

NULL or NOT NULL in relational design

2006-01-23 Thread Danny Stolle
Hi, I am often running into this type of design, but would it be a good design. Normally you design tables related to each other and having e.g. parameter tables like a country-table holding country names with their country-id's; and you will find these country-ids back in other tables, which

Re: NOT NULL and default: using mysqldump to upgrade from 4.0 to 5.0

2005-12-24 Thread Gleb Paharenko
abase. The new server is >running MySQL 5.0. > >Trying to import a table such as > >CREATE DATABASE /*!32312 IF NOT EXISTS*/ db17058c; >USE db17058c; >DROP TABLE IF EXISTS adidas; >CREATE TABLE adidas ( > manufacturer char(1) NOT NULL default '', >

NOT NULL and default: using mysqldump to upgrade from 4.0 to 5.0

2005-12-24 Thread Alex Davies
adidas; CREATE TABLE adidas ( manufacturer char(1) NOT NULL default '', brand char(1) NOT NULL default '', product varchar(100) NOT NULL default '', short text NOT NULL, long text NOT NULL, id int(11) NOT NULL default '0', image varchar(124) NO

Re: Bug? Set Null Value in NOT NULL field...

2005-10-28 Thread Joerg Bruehe
Hi! LMS wrote: Jeff Smelser escribió: On Wednesday 26 October 2005 04:24 pm, LMS wrote: Hi, I have this structure: --- CREATE TABLE tabla ( id int(10) unsigned NOT NULL auto_increment, nombre varchar(100) NOT NULL default '', be

Re: Bug? Set Null Value in NOT NULL field...

2005-10-27 Thread LMS
Jeff Smelser escribió: On Wednesday 26 October 2005 04:24 pm, LMS wrote: Hi, I have this structure: --- CREATE TABLE tabla ( id int(10) unsigned NOT NULL auto_increment, nombre varchar(100) NOT NULL default '', because your defaul

Re: Bug? Set Null Value in NOT NULL field...

2005-10-27 Thread Jeff Smelser
On Wednesday 26 October 2005 04:24 pm, LMS wrote: > Hi, > I have this structure: > --- > CREATE TABLE tabla ( >id int(10) unsigned NOT NULL auto_increment, >nombre varchar(100) NOT NULL default '', because your d

Bug? Set Null Value in NOT NULL field...

2005-10-27 Thread LMS
Hi, I have this structure: --- CREATE TABLE tabla ( id int(10) unsigned NOT NULL auto_increment, nombre varchar(100) NOT NULL default '', PRIMARY KEY (id), UNIQUE KEY nombre (nombre), UNIQUE KEY id (id) ) ENGINE=MyISAM; SELECT *

Re: not null values

2005-08-29 Thread Michael Stassen
joshua pereira wrote: i want to make it so that i will have to fill in all the attributes in .so i put not null for all the attributes. Is this correct ?? when for example do not fill in user_name , all the other values is accepted and stored in the databaseplease advise create table

RE: not null values

2005-08-29 Thread Sujay Koduri
Use the keyword 'default' to make the attributes default to the values you want. Use some thing like this user_name varchar(50) default 'default_value' not null sujay -Original Message- From: joshua pereira [mailto:[EMAIL PROTECTED] Sent: Monday, August 29, 20

not null values

2005-08-29 Thread joshua pereira
i want to make it so that i will have to fill in all the attributes in .so i put not null for all the attributes. Is this correct ?? when for example do not fill in user_name , all the other values is accepted and stored in the databaseplease advise create table user_details (user_id varchar

Re: Regarding NOT NULL Option for Table Fields....

2005-06-13 Thread mfatene
Hi, > > '' or empty string is not a null in mysql. This is > > true for Oracle ! > > this simple test lets you understand : > > > > * Without NULLs > > mysql> create table notnull (t varchar(10) NOT > > NULL); > >

Re: Regarding NOT NULL Option for Table Fields....

2005-06-12 Thread mfatene
Hi, '' or empty string is not a null in mysql. This is true for Oracle ! this simple test lets you understand : * Without NULLs mysql> create table notnull (t varchar(10) NOT NULL); Query OK, 0 rows affected (0.14 sec) mysql> insert into notnull values('tes

Re: Regarding NOT NULL Option for Table Fields....

2005-06-12 Thread Michael Stassen
Ashok Kumar wrote: Hi friends, I'm having one doubt on "NOT NULL" specification for the table field properties. That is i have created on table-mine which contains name(Not Null) and pwd(Not Null). Now I intended to execute the following query. "insert into mine values(

Regarding NOT NULL Option for Table Fields....

2005-06-12 Thread Ashok Kumar
Hi friends, I'm having one doubt on "NOT NULL" specification for the table field properties. That is i have created on table-mine which contains name(Not Null) and pwd(Not Null). Now I intended to execute the following query. "insert into mine values('',''

Re: why NOT NULL in PRIMARY key??

2005-05-01 Thread Martijn Tonies
> > create table a ( > > b int not null, > >c int null > >primary_key(b,c) > > ); > > > > With values: > > 1 null > > 1 null > > > > Logically these are unique records under the standard proviso that > > null != n

Re: why NOT NULL in PRIMARY key??

2005-04-30 Thread Jigal van Hemert
From: <[EMAIL PROTECTED]> > create table a ( > b int not null, >c int null >primary_key(b,c) > ); > > With values: > 1 null > 1 null > > Logically these are unique records under the standard proviso that > null != null. Yet how could I unique

Re: syntax errors with ENGINE=MYISAM... and NOT NULL default CURRENT_TIMESTAMP ...

2005-04-30 Thread Gleb Paharenko
> >no sql errors. > >Next snytax error I get is: >Create table 'testime' ( 'teatime' timestamp NOT NULL default >CURRENT_TIMESTAMP on update >CURRENT_TIMESTAMP, > 'val' char(22) NOT Null); >

Re: why NOT NULL in PRIMARY key??

2005-04-29 Thread beacker
a good reason other than "because our ancestors always did it >this way". Let's look at it from a pure logic point of view. Given the table: create table a ( b int not null, c int null primary_key(b,c) ); With values: 1 null 1 null Logica

syntax errors with ENGINE=MYISAM... and NOT NULL default CURRENT_TIMESTAMP ...

2005-04-29 Thread Jacob, Raymond A Jr
latin1; I get a sql error telling me to check the syntax for this version. I modified the line to ENGINE=MYISAM CHARSET=latin1; no sql errors. Next snytax error I get is: Create table 'testime' ( 'teatime' timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TI

Re: why NOT NULL in PRIMARY key??

2005-04-28 Thread Jigal van Hemert
From: "Frank Bax" > At 11:07 AM 4/27/05, Jigal van Hemert wrote: > >So, if we would define that the key entry "0-NULL-Whatever" equals > >"0-NULL-Whatever" (which MySQL is capable of if you look at the definition > >of UNIQUE indexes with BDB tables) then allowing NULLs as part of a key > >entry w

Re: why NOT NULL in PRIMARY key??

2005-04-27 Thread Joerg Bruehe
ing to use NULL for. Let me add an aspect which I did not find mentioned yet: The SQL syntax differs for NULL and non-NULL values! As long as your key columns have the "NOT NULL" property, you can alwas say "WHERE keycol = value". When you qualify by a NULL value, you need to sa

Re: why NOT NULL in PRIMARY key??

2005-04-27 Thread Peter Brawley
uld not permit duplicate entries. At least not more than allowing other values. Because there is a considerable performance difference between primary and secudary keys in InnoDB it would enable more flexible primary keys that can also be used for searching. It would mean breaking with the standar

Re: why NOT NULL in PRIMARY key??

2005-04-27 Thread Frank Bax
At 11:07 AM 4/27/05, Jigal van Hemert wrote: So, if we would define that the key entry "0-NULL-Whatever" equals "0-NULL-Whatever" (which MySQL is capable of if you look at the definition of UNIQUE indexes with BDB tables) then allowing NULLs as part of a key entry would not permit duplicate entries

Re: why NOT NULL in PRIMARY key??

2005-04-27 Thread Jigal van Hemert
lues. Because there is a considerable performance difference between primary and secudary keys in InnoDB it would enable more flexible primary keys that can also be used for searching. It would mean breaking with the standard (PRIMARY = UNIQUE + NOT NULL), so it's not likely that it will e

Re: why NOT NULL in PRIMARY key??

2005-04-27 Thread Peter Brawley
Jigal >Anyway, I gues it's just a question of following a standard and optimizing >the engine according to that standard. Your proposal would permit dupe primary keys. It's a question of preventing them. PB - Jigal van Hemert wrote: From: "Mikhail Entaltsev" Mikhail, Bef

Re: why NOT NULL in PRIMARY key??

2005-04-27 Thread Martijn Tonies
> > [snip] > > The same is true for any other value... Now that the columns have a NOT > > NULL > > constraint the records that previously contained NULL now hold '0'. > > > > x y > > x 0 > > x z > > x 0 > > > > Now

Re: why NOT NULL in PRIMARY key??

2005-04-27 Thread Dawid Kuroczko
On 4/26/05, Jay Blanchard <[EMAIL PROTECTED]> wrote: > [snip] > The same is true for any other value... Now that the columns have a NOT > NULL > constraint the records that previously contained NULL now hold '0'. > > x y > x 0 > x z > x 0 > >

Re: why NOT NULL in PRIMARY key??

2005-04-27 Thread Jigal van Hemert
From: "Mikhail Entaltsev" Mikhail, > Before inserting MySQL will try to find a record with the same values. > But since comparison with NULL value returns always FALSE > MySQL will think that there is no such record in the table. > After this point you will get 2 identical records in the table.

RE: why NOT NULL in PRIMARY key??

2005-04-26 Thread emierzwa
; mysql@lists.mysql.com Subject: Re: why NOT NULL in PRIMARY key?? > Not every DBMS... > > MSSQL: > Create Unique Index > Microsoft(r) SQL Server(tm) checks for duplicate values when the index > is created (if data already exists) and checks each time data is added > with an INSER

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jochem van Dieten
On 4/26/05, Jigal van Hemert wrote: > From: "Jochem van Dieten" >>> Why is this? >> >> Because the SQL standard says so. > > A true observation, but still no explanation or reason why ;-P I consider it a good enough explanation of why MySQL doesn't allow it. As to why the SQL standard doesn't al

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Martijn Tonies
> > >I would understand it if it would mean that the key as a whole could not > be > > >NULL, but the restriction that each column that is part of a PRIMARY KEY > > >must have the NOT NULL constraint is not logical. > > > > Sure it is. If any part coul

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jigal van Hemert" <[EMAIL PROTECTED]> writes: > From: "Harald Fuchs" >> > id INT(11) - accountID >> > name VARCHAR(32) - parameter name >> > value INT(11) - parameter value >> >> > Other tables contain string, datetime, etc. parameters. >> >> > Since most searche

RE: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jay Blanchard
[snip] The same is true for any other value... Now that the columns have a NOT NULL constraint the records that previously contained NULL now hold '0'. x y x 0 x z x 0 Now, how do you uniquely identify the 2nd and 4th rows? [/snip] The database would have thrown an error when yo

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Peter Brawley
ines a PRIMARY KEY as a combination >between UNIQUE and NOT NULL, but it's still not clear to me why >this implies that all *parts* of the primary key *must* also have the >NOT NULL constraint. Allow NULLs as PK components and you destroy two things at once, PK logic and performanc

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
From: "Paul DuBois" > >I would understand it if it would mean that the key as a whole could not be > >NULL, but the restriction that each column that is part of a PRIMARY KEY > >must have the NOT NULL constraint is not logical. > > Sure it is. If any part co

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Mikhail Entaltsev
khail. - Original Message - From: "Jigal van Hemert" <[EMAIL PROTECTED]> To: "Dawid Kuroczko" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, April 26, 2005 4:47 PM Subject: Re: why NOT NULL in PRIMARY key?? > From: "Dawid Kuroczko" > > > > It can&

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Paul DuBois
e-account_id. InnoDB is very fast if you use the primary key and a lot slower if you use secudary key(s), so queries can get considerably faster if you use a primary key. My combined key would be able to uniquely identify records. I know the SQL standard defines a PRIMARY KEY as a combination between UNI

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread SGreen
"Jigal van Hemert" <[EMAIL PROTECTED]> wrote on 04/26/2005 10:35:06 AM: > From: "Harald Fuchs" > > > > id INT(11) - accountID > > > name VARCHAR(32) - parameter name > > > value INT(11) - parameter value > > > > > Other tables contain string, datetime, etc. parameters. > > > > > Since most search

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Martijn Tonies
se SELECT statements will > > return exactly one (different) row. > With the NULL values included it will still uniquely identify each row... > > I would understand it if it would mean that the key as a whole could not be > NULL, but the restriction that each column that is part of

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Paul DuBois
these SELECT statements will return exactly one (different) row. With the NULL values included it will still uniquely identify each row... I would understand it if it would mean that the key as a whole could not be NULL, but the restriction that each column that is part of a PRIMARY KEY must have

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
er if you use a primary key. My combined key would be able to uniquely identify records. I know the SQL standard defines a PRIMARY KEY as a combination between UNIQUE and NOT NULL, but it's still not clear to me why this implies that all *parts* of the primary key *must* also have the NOT NULL cons

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
tements will > return exactly one (different) row. With the NULL values included it will still uniquely identify each row... I would understand it if it would mean that the key as a whole could not be NULL, but the restriction that each column that is part of a PRIMARY KEY must have the NOT NULL

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Paul DuBois
ently converted all "NULL" constraints to "NOT NULL" for the columns that are part of the primary key and converted all NULL values in the db to the appropriate default values for the various column types. Regards, Jigal. -- Paul DuBois, MySQL Documentation Team Madison, Wisconsin, USA MyS

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
From: "Jochem van Dieten" > > Why is this? > > Because the SQL standard says so. A true observation, but still no explanation or reason why ;-P MySQL doesn't follow the standard in every situation, so that's not an excuse... (no offense!) There must be a good reason other than "because our ancesto

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Martijn Tonies
> > A primary key absolutely forbids duplicate values. > > > > Indexes created with the UNIQUE keyword do not allow duplicates, except > > for the special case that multiple NULL values are allowed. > > I realise that it may (and is) defined in such a way, but it still does not > explain *why* par

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Dawid Kuroczko
On 4/26/05, Jigal van Hemert <[EMAIL PROTECTED]> wrote: > And http://dev.mysql.com/doc/mysql/en/create-table.html tells me that "A > PRIMARY KEY is a unique KEY where all key columns must be defined as NOT > NULL. If they are not explicitly declared as NOT NULL, MySQL declares

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
From: "Harald Fuchs" > > id INT(11) - accountID > > name VARCHAR(32) - parameter name > > value INT(11) - parameter value > > > Other tables contain string, datetime, etc. parameters. > > > Since most searches are made for a value (or range) of one or more > > parameters, a usable primary key is:

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Martijn Tonies
> Not every DBMS... > > MSSQL: > Create Unique Index > Microsoft(r) SQL Server(tm) checks for duplicate values when the index > is created (if data already exists) and checks each time data is added > with an INSERT or UPDATE statement. If duplicate key values exist, the > CREATE INDEX statement

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
iderably. Some queries turned out to be quite slow and we found that these relied on NULL values. Converting the index to primary silently converted all "NULL" constraints to "NOT NULL" for the columns that are part of the primary key and converted all NULL values in the db to

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jigal van Hemert" <[EMAIL PROTECTED]> writes: > From: "Martijn Tonies" >> Ehm... it might be me - but what sense does it make to have a NULL >> in a PK? >> If you "need" this, then your primary key probably isn't a primary key. >> >> Care to explain why and how yo

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Paul DuBois
At 15:20 +0200 4/26/05, Jigal van Hemert wrote: From: "Jay Blanchard" Since NULL is the absence of a value and PRIMARY keys must have a value a NULL column cannot be included as a portion of a PRIMARY key. AFAIK this is the case with every RDBMS out there. Asking the development team might get

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
From: "Martijn Tonies" > Ehm... it might be me - but what sense does it make to have a NULL > in a PK? > If you "need" this, then your primary key probably isn't a primary key. > > Care to explain why and how you're designing your database? Martijn, The table contains an variable number of integ

RE: why NOT NULL in PRIMARY key??

2005-04-26 Thread SGreen
-index.html = If you do not define a PRIMARY KEY for your table, MySQL picks the first UNIQUE index that has only NOT NULL columns as the primary key and InnoDB uses it as the clustered index. If there is no such index in the table, InnoDB internally

RE: why NOT NULL in PRIMARY key??

2005-04-26 Thread Frank Bax
At 08:49 AM 4/26/05, Jay Blanchard wrote: [snip] http://dev.mysql.com/doc/mysql/en/silent-column-changes.html mentions that "Columns that are part of a PRIMARY KEY are made NOT NULL even if not declared that way. " And http://dev.mysql.com/doc/mysql/en/create-table.html tells me that

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jochem van Dieten
On 4/26/05, Jigal van Hemert wrote: > http://dev.mysql.com/doc/mysql/en/silent-column-changes.html > mentions that "Columns that are part of a PRIMARY KEY are made NOT NULL even > if not declared that way. " > > And http://dev.mysql.com/doc/mysql/en/create-table.html t

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
From: "Jay Blanchard" > Since NULL is the absence of a value and PRIMARY keys must have a value > a NULL column cannot be included as a portion of a PRIMARY key. AFAIK > this is the case with every RDBMS out there. Asking the development team > might get you a more informative response. > > There

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Martijn Tonies
> http://dev.mysql.com/doc/mysql/en/silent-column-changes.html > mentions that "Columns that are part of a PRIMARY KEY are made NOT NULL even > if not declared that way. " > > And http://dev.mysql.com/doc/mysql/en/create-table.html tells me that "A > PRIMARY

RE: why NOT NULL in PRIMARY key??

2005-04-26 Thread emierzwa
PROTECTED] Sent: Tuesday, April 26, 2005 6:50 AM To: Jigal van Hemert; mysql@lists.mysql.com Subject: RE: why NOT NULL in PRIMARY key?? Since NULL is the absence of a value and PRIMARY keys must have a value a NULL column cannot be included as a portion of a PRIMARY key. AFAIK this is the case

RE: why NOT NULL in PRIMARY key??

2005-04-26 Thread Jay Blanchard
[snip] http://dev.mysql.com/doc/mysql/en/silent-column-changes.html mentions that "Columns that are part of a PRIMARY KEY are made NOT NULL even if not declared that way. " And http://dev.mysql.com/doc/mysql/en/create-table.html tells me that "A PRIMARY KEY is a unique KEY where

why NOT NULL in PRIMARY key??

2005-04-26 Thread Jigal van Hemert
http://dev.mysql.com/doc/mysql/en/silent-column-changes.html mentions that "Columns that are part of a PRIMARY KEY are made NOT NULL even if not declared that way. " And http://dev.mysql.com/doc/mysql/en/create-table.html tells me that "A PRIMARY KEY is a unique KEY where all key

Re: date time functions don't return not null rows

2004-10-16 Thread Eric Bergen
Your tables aren't setup very well. You should google for normalization and 'boyce codd normal form' -Eric On Sat, 16 Oct 2004 22:27:51 +0200, owca <[EMAIL PROTECTED]> wrote: > I'm trying get current week, starting from monday to sunday: > > select UNIX_TIMESTAMP(day), g15, g16, g17, g18, g19,

date time functions don't return not null rows

2004-10-16 Thread owca
I'm trying get current week, starting from monday to sunday: select UNIX_TIMESTAMP(day), g15, g16, g17, g18, g19, g20, g21, g22, id from tydzien where to_days(day) between to_days(now())- mod(to_days(now()),7)+2 /*some parameter setting a starting day*/ and (to_days(now())- mod(to_days(now()),7)

RE: inserting null to not null columns

2004-09-21 Thread Thomas Lundström
nt of dirty data between different systems. Be careful when not including NOT NULL columns in your inserts... To get around the problem and get more background info, read: http://dev.mysql.com/doc/mysql/en/constraint_NOT_NULL.html Regards, Thomas Lundström, Ongame E-Solutions AB -Ori

inserting null to not null columns

2004-09-21 Thread Donna Hinshaw
can successfully insert rows into a table without including a value for a column which should be blocking nulls. e.g. Table A id (PK, auto increment) name type ssn ( nulls allowed specified) ==> name and type do not have nulls allowed specified, so I think they should be NOT N

Re: NOT NULL

2004-08-08 Thread Rhino
- Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "MySQL" <[EMAIL PROTECTED]> Sent: Sunday, August 08, 2004 11:13 PM Subject: NOT NULL > Can someone give me a quick/clear explanation about why you would > create a table with col

Re: NOT NULL

2004-08-08 Thread Whil Hentzen
On Sunday 08 August 2004 22:13, Justin French wrote: > Can someone give me a quick/clear explanation about why you would > create a table with columns of NULL / NOT NULL? > > I clicked around the MySQL manual last night I *think* I know what's > what, but it'd be great to

NOT NULL

2004-08-08 Thread Justin French
Can someone give me a quick/clear explanation about why you would create a table with columns of NULL / NOT NULL? I clicked around the MySQL manual last night I *think* I know what's what, but it'd be great to read one clear paragraph that summarises it all. --- Justin F

AW: NOT NULL column behaves strangely

2004-04-14 Thread B. Fongo
Ja! Most RDBMS don't use default values for NOT NULL columns. Rather they alarm if a statement renders such fields NULL. I do agree with Michael. Mysql went a different way in this regard, in that it assigns default values... It only warns if one tries to explicitly enter "NULL&qu

Re: NOT NULL column behaves strangely

2004-04-14 Thread Michael Stassen
Ruslan U. Zakirov wrote: Keith C. Ivey wrote: On 14 Apr 2004 at 17:27, B. Fongo wrote: I expected a warning because of the Token column shouldn't be NULL! It's not NULL. It's the empty string, which is the default value, since you didn't give it a specific default val

  1   2   3   >