1

I want to check if a table contains an index.

My query didn`t compiled on MySql workbench. How can i test if on a table exists index to then drop only the index from it?

It would be something like that:

ALTER TABLE my_table DROP INDEX medicos_cpf
    WHERE EXISTS (SELECT * FROM my_table WHERE INDEX = "medicos_cpf");
jarlh
  • 42,561
  • 8
  • 45
  • 63
Matheus Carvalho
  • 415
  • 7
  • 13
  • 1
    Check https://stackoverflow.com/questions/2480148/how-can-i-employ-if-exists-for-creating-or-dropping-an-index-in-mysql – parthivrshah Aug 16 '19 at 11:41

0 Answers0