1

I have deleted all the data from an existing table and then trying to alter table using the following query in mysql:

 ALTER TABLE mytable ADD INDEX (created_on);

but nothing seems to working, it just keep running with out any result.

1
  • What does SHOW INDEX FROM mytable tell you after you have executed the ALTER statement? Commented Jun 23, 2014 at 12:57

1 Answer 1

1

Here is a correct way to add an index:

create index idx_mytable_createdon on mytable(created_on);
Sign up to request clarification or add additional context in comments.

1 Comment

Hence you use the create index statement as in my answer.

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.