1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
answerbook/sql/old/tmp_table.sql
2022-09-25 01:39:19 +08:00

10 lines
381 B
SQL

-- CREATE TEMPORARY TABLE tmp_table SELECT distinct text FROM answer
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`);