+ 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

26th Sep 2018, 9:29 AM
Mamuya, Gilbert .W
Mamuya, Gilbert .W - avatar
3 Réponses
+ 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...
26th Sep 2018, 6:30 PM
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱 - avatar
+ 2
Thank you
6th Mar 2019, 12:06 AM
Mamuya, Gilbert .W
Mamuya, Gilbert .W - avatar
+ 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.
6th Mar 2019, 9:48 AM
Adhit Narayanan
Adhit Narayanan - avatar