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?

Answers were Sorted based on User's Feedback



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

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

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

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

Post New Answer

More MySQL Interview Questions

Define REGEXP?

0 Answers  


How can you add and remove any column of a table?

0 Answers  


In the below example, how many String Objects are created? String s1="I am Java Expert"; String s2="I am C Expert"; String s3="I am Java Expert";

1 Answers  


What is information_schema in mysql?

0 Answers  


In PHPmysql language how can we update our previous information.when update form open then we get our previous information in textbox,checkbox,selct,radio button.How can we show the information in checkbox,select menu,radio button which is available in database?

0 Answers  


What?s the difference between PRIMARY KEY and UNIQUE in MyISAM?

4 Answers   Aufait, CSS, Wipro,


what are the optimization techniques for Query optimization performance issues and faster execution of queries

2 Answers   Infosys, Sierra Atlantica,


How do I change global variables in mysql?

0 Answers  


How to set mysql variable in php?

0 Answers  


How to use rank function in mysql?

0 Answers  


Why do we use views instead of tables?

0 Answers  


What is difference between mysql and mysql server?

0 Answers  


Categories