您的位置:首页 > 博客中心 > 数据库 >

Mysql 如何删除数据表中的重复数据!

时间:2022-03-10 17:34

1、使用distinct查询所有不重复的记录

2、创建数据表相同结构的临时表,将第一步的数据复制进去

    create temporary table if not exists student_temp as (select distinct(name), sex from student);

3、truncate table student;

4、insert into student(id,name,sex) select null,name,sex from student_temp;

 

 

Mysql 如何删除数据表中的重复数据!,布布扣,bubuko.com

热门排行

今日推荐

热门手游