0
0

More than 1 year has passed since last update.

MySQLでデータを一括削除してidを1から振りなおす

Posted at

やる事

データベースのテーブル内の情報を有無を言わさず全削除。そしてidを1から振り直します。
外部キー制約付いてると一括削除できません。

//一括削除
truncate table テーブル名;
//idを1から振りなおす
ALTER TABLE テーブル名 AUTO_INCREMENT =1;

ていう感じです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0