A Little Noise

November 19, 2005

Concatenating NULL

Filed under: MySQL Gotchas — snoyes @ 4:00 am
CREATE TABLE myTable (
 id INT,
 string varchar(100) DEFAULT NULL
);
INSERT INTO myTable (id, string) VALUES (1, "First"), (2, NULL);
UPDATE myTable SET string = CONCAT(id, " has the value ", string);
SELECT * FROM myTable;

What is the output?
Show Answer ▼

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress