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.

1 Answer 1

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;
Sign up to request clarification or add additional context in comments.

3 Comments

Rather than answering such typo questions, just vote to close them.
@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.
@Forward Sorry about the typo, the error wasn't typo. The error is most likley due to two TIMESTAMP column in one table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.