MySQL关键字Distinct用法介绍
DDL
Prepare SQL:
create table test(id bigint not null primary key auto_increment, name varchar(10) not null, phone varchar(10) not null, email varchar(30) not null)engine=innodb;
Prepare Data:
insert into test(name, phone, email)values('alibaba','0517','alibaba@alibaba.com'); insert into test(name, phone, email)values('alibaba','0517','alibaba@alibaba.com'); insert into test(name, phone, email)values('baidu','010','baidu@baidu.com'); insert into test(name, phone, email)values('tencent','0755','tencent@tencent.com'); insert into test(name, phone, email)values('vipshop','020','vipshop@vipshop.com'); insert into test(name, phone, email)values('ctrip','021','ctrip@ctrip.com'); insert into test(name, phone, email)values('suning','025','suning@suning.com');
查询数据如下图所示: