Jason
Jason

Reputation: 11363

Dropping database table

While I was importing production data into my development database, something went off and I now have two database tables that are similar, differing only that one contains the db name as a table prefix.

In this case, I have a database rmstg, and two tables

main_stratkeys
rmstg.main_stratkeys

How can I drop the latter table?

DROP TABLE rmstg.main_stratkeys drops the first table, but not the latter.

DROP TABLE rmstg.rmstg.main_stratkeys returns a SQL syntax error with the inner .rmstg. declaration.

Upvotes: 0

Views: 73

Answers (2)

starlocke
starlocke

Reputation: 3681

Assuming you're using the CLI:

USE rmstg;
DROP TABLE main_stratkeys;

Is also an option.

Backquotes should also be helpful, dunno that syntax, exactly, though.

Upvotes: 1

Gordon Linoff
Gordon Linoff

Reputation: 1270873

Try using backquotes:

drop table `rmstg.main_stratkeys`;

or

drop table rmstg.`rmstg.main_stratkeys`;

Upvotes: 1

Related Questions