1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
answerbook/sql/tmp_table.sql

10 lines
381 B
MySQL
Raw Normal View History

2022-09-24 20:55:17 +08:00
-- CREATE TEMPORARY TABLE tmp_table SELECT distinct text FROM answer
2022-09-24 21:49:09 +08:00
drop table if exists tmp_table;
CREATE TABLE tmp_table SELECT distinct text FROM answer order by text;
drop table if exists answer;
ALTER TABLE tmp_table RENAME answer;
ALTER TABLE `answer`
ADD COLUMN `id` int NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (`id`),
ADD UNIQUE INDEX(`text`);