List:General Discussion« Previous MessageNext Message »
From:C.R.Vegelin Date:December 5 2005 10:24pm
Subject:defined with default NULL, but missing ...
View as plain text  
Hi everybody,
I defined a field Date_End with default NULL, but am missing it.

CREATE TABLE Regions
( Country CHAR(4) NOT NULL,
  Date_Start CHAR(4) NOT NULL,
  Date_End CHAR(4) default NULL,  # this one ...
  Description CHAR(50)
) Engine = MyISAM;

Regions table is filled with a tab-delimited input table like:
0001    1997    2500     France
1000    1976                WORLD
1010    1976                INTRA-EUR

LOAD DATA INFILE '../Regions.txt' INTO TABLE Regions
FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n' IGNORE 0 LINES;
SELECT * FROM Regions WHERE Country >= 1000;
+---------+------------+----------+--------------+
| country | date_start | date_end | description |
+---------+------------+----------+--------------+
| 1000   | 1976          |                | WORLD |
| 1010   | 1976          |                | INTRA-EUR |
| 1011   | 1976          |                | EXTRA-EUR |
etc.

Question: why is NULL not shown for date_end ?

DELETE FROM Regions WHERE Country >= 1000 AND Date_End < 2001;
Query OK; 33 rows affected; 

SELECT * FROM Regions WHERE Country >= 1000;
Empty Set

Question: So NULL values are matching Date_End < 2001 in the DELETE ???

I am using MySQL version 5.0.15-nt. Help will be appreciated.
Cor Vegelin




Thread
defined with default NULL, but missing ...C.R.Vegelin5 Dec
  • Re: defined with default NULL, but missing ...Michael Stassen5 Dec