what if you really want to store the timestamp data, such
as the publication date of the article?
Answers were Sorted based on User's Feedback
Answer / tim little
A timestamp field can hold a date passed to it!
If you do :
CREATE TABLE newtable ( aname varchar(32), pubdate timestamp );
INSERT INTO newtable ( aname, pubdate ) values ( 'first', '2009-07-08' );
and then do a
SELECT * from newtable;
Then you get "2009-07-08 00:00:00" as the date back! You don't need a second field. Why do people think this? I've seen this all around the internet and it's always wrong!
Now, I will tell you that any updates to that ROW WILL clobber the field, UNLESS you make efforts to put the old value back in, like :
update newtable set aname = 'now', pubdate=pubdate where aname = 'first';
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / amith
Create two columns of type TIMESTAMP and use the second one
for your real data.
| Is This Answer Correct ? | 0 Yes | 3 No |
Can foreign key have duplicate values?
What does mysql flush privileges do?
What is the difference between procedure and function in mysql?
what are the main differences between MyISAM and InnoDB table storage structures ? what are the advantages and disadvantages in usage of these ?
10 Answers E2 Solutions, Tesco,
What is mysql data directory? How to determine the location of the data directory?
How to find the unique values if the value in the column is repeated?
Can I use mysql for free?
How we can get the current date in mysql?
What do ddl, dml, and dcl stand for?
How many threads can mysql handle?
How to show all tables with 'mysql'?
What is mysql good for?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)