- URL:
- http://www.phpfreaks.com/blog/article-on-mysql-number-columns-and-update-statements-on-numeric-types
- Print Date:
- Nov 21, 2024 7:41:21 PM
Blog: Article on MySQL Number columns and UPDATE statements on numeric types
by Feb 13, 2009 3:25:13 PM
on - Views:
- 11556
Here's something about mysql create table definitions that can easily catch you if you aren't careful. Consider this table definition:
CREATE TABLE screenshots (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, votes INT);
What the user wanted was a simple table to keep track of user submitted screen shots. Of course the real table had a submission date, and name column but I've omitted those in order to focus on what can happen when you allow a numeric column to have NULL values.
http://www.gizmola.com/blog/archives/91-Mysql-Update-Null-+-1-is-Null!.html [http://www.gizmola.com/blog/archives/91-Mysql-Update-Null-+-1-is-Null!.html]