Auto-update timestamp field
August 13th, 2008I keep on forgetting this SQL query. So I decided to put it here as a reference:
CREATE TABLE testtbl (
id int AUTO_INCREMENT,
created_on TIMESTAMP DEFAULT 0,
updated_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP,
first_name varchar(25),
last_name varchar(25),
primary key(id)
);
Leave a Reply
Pages
Categories
- Apache (1)
- CSS (2)
- Database (2)
- Development (9)
- Gadget (3)
- Google (4)
- How-To (16)
- HTML (2)
- Internet (4)
- JavaScript (2)
- Linux (15)
- Music (3)
- MySQL (2)
- PHP (4)
- Python (1)
- Sport (1)
- Subversion (4)
- Uncategorized (3)
- Windows (6)
- Wordpress (2)
Archives















