Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
特定の 4 つのテーブルを除いて、スキーマ (数百のテーブルがある) 内のすべてのテーブルを TRUNCATE するためのクエリ (または一連の) を探しています。どうすればそれを行うことができますか?ありがとう!
もう1つの方法は、これら4つのテーブルを新しいスキーマにコピーしてから、元のデータベーススキーマを削除することです。
*nix ワンライナー:
for i in `mysql -e "show tables MY_DB" | grep -vE "(table1|table2)"`; do mysql -e"TRUNCATE ${i}" MY_DB; done