Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what if you really want to store the timestamp data, such
as the publication date of the article?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is mysql cursor?

898


What are mysql queries?

928


Consider a scenario where you have two to three tables with thousand tuples in each of them. Now, if you have to perform a join operation between them will you choose to perform filtering of rows or transforming of rows first.

996


What is pdo in mysql?

938


What is memory table in mysql?

946


What is the maximum size of mysql database?

955


Explain the different types of mysql joins.

934


What is the maximum no of columns a table can have?

913


What is the storage engine for mysql?

961


Does mysql automatically index foreign keys?

931


How to extract a unit value from a date and time?

946


How to create a table index in mysql?

968


What does mysql_fetch_assoc do?

965


How do I backup mysql database on linux?

942


what is the difference between the nvl function, ifnull function, and the isnull function? : Mysql dba

1098