+ 5
May someone explain to me this query please.
i was looking for a query to drop all tables with a given prefix, i searched and got this code from stackOverflow, but i dont understand it, anyone who does may him or her explain this to me please https://code.sololearn.com/WHSn6ev8950q/?ref=app
3 odpowiedzi
+ 6
It takes the table names from INFORMATION_SCHEMA and checks if each one of them begins with prefix. If it does, it adds the name to the list of tables to be dropped. After it checks all the names, it executes the DROP command...
Before running this procedure, you should backup your DB and replace prefix withe your own table name prefix...
+ 2
Thank you
+ 1
I have an alternative answer for dropping all tables. Drop table <tablename>; . Use this its much easier. To copy the text press 'up' arrow key then it gets copied. You will have to change only the table name.