Was performing some simple tests for the use of NULL in a table.
Can't get NULL to display, it only displays N ?
I have a table called 'pet'
mysql> SELECT * FROM pet;
+----------+---------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+---------+---------+------+------------+------------+
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Bowser | Diane | dog | m | 1985-08-31 | 1995-07-29 |
| Whistler | Gwen | bird | N | 1997-12-09 | NULL |
| Slim | Benny | snake | m | 1996-04-29 | NULL |
+----------+---------+---------+------+------------+------------+
The 'Whistler' name row under 'sex' is 'N' not 'NULL' ?
I put this in pet.txt:
__________________________________________________________
Buffy Harold dog f 1989-05-13 \N
Bowser Diane dog m 1998-08-31 1995-07-29
Whistler Gwen bird \N 1997-12-09 \N
Slim Benny snake m 1996-04-29 \N
----------------------------------------------------------
and did:
mysql> LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet;
Why is the NULL not showing?
Then i just did:
mysql> delete * pet where owner = "Gwen";
mysql> INSERT INTO pet
mysql> VALUES ('Whistler','Gwen','bird',NULL,'1997-12-09',NULL);
mysql> FLUSH PRIVILEGES;
mysql> SELECT * FROM pet;
+----------+---------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+---------+---------+------+------------+------------+
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Bowser | Diane | dog | m | 1985-08-31 | 1995-07-29 |
| Whistler | Gwen | bird | NULL | 1997-12-09 | NULL |
| Slim | Benny | snake | m | 1996-04-29 | NULL |
+----------+---------+---------+------+------------+------------+
4 rows in set (0.00 sec)
Now it is correct. Does LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet;
not take \N as NULL in a center field? The docs says it does, but ......
\\|//
___________ooO_(o"o)_OoO__________
Darrell Shifflett | (_) |
Self Proposed | Sometimes the simplest things |
Linux Freak & PERL Lover | in life are often the best |
| - Diethyl |
bluez@stripped |___________oooO_____Oooo__________|
http://www.BLUEZnet.com ( )/ ( ,)
\_) (_/
| Thread |
|---|
| • NULL ? | Darrell Shifflett | 16 Apr |
| • NULL ? | Michael Widenius | 17 Apr |