0
CREATE TABLE IF NOT EXISTS `xyz` (
   `id` INT(11) NOT NULL AUTO_INCREMENT ,
   `start_time` TIMESTAMP NOT NULL,
   `end_time` TIMESTAMP NOT NULL,
   PRIMARY KEY (`id`) ) 
 ENGINE = InnoDB;

Running the above mysql script results in: Error Code: 1067. Invalid default value for 'start_time'. The error is most likely due to two TIMESTAMP column in one table

Similar answer to this question is vague. Invalid default value for 'create_date' timestamp field

I need a clear solution.

sdfdsf sdf
  • 383
  • 1
  • 5
  • 12

1 Answers1

1

You've missed backticks ` before xyz:

CREATE TABLE IF NOT EXISTS `xyz` (
   `id` INT(11) NOT NULL AUTO_INCREMENT ,
   `start_time` TIMESTAMP NOT NULL,
   `end_time` TIMESTAMP NOT NULL,
   PRIMARY KEY (`id`) ) 
ENGINE = InnoDB;
Blank
  • 12,308
  • 1
  • 14
  • 32
  • Rather than answering such typo questions, just vote to close them. – Tim Biegeleisen Sep 25 '17 at 02:52
  • @TimBiegeleisen Maybe not a typo question to OP, we can not suppose everyone would have been very familiar with `mysql`, and OP have tried to search answers, but he or she did not get it. Maybe I should take this answer as a comment, but I hold a reservation about voting to close. – Blank Sep 25 '17 at 03:02
  • @Forward Sorry about the typo, the error wasn't typo. The error is most likley due to two TIMESTAMP column in one table. – sdfdsf sdf Sep 29 '17 at 05:02