| 1 |
create table t1 ( c1 varchar(10), c2 varchar(10), c3 int ); |
| 2 |
insert into t1 values ("a" , "b", 1), ("a" , "b", 2); |
| 3 |
create table t2 like t1 ; |
| 4 |
alter table t2 add column c4 bigint unsigned as (CONV(LEFT(MD5(concat(c1,c2,c3)), 16), 16, 10)) persistent unique key; |
| 5 |
select * into outfile 't1.csv' from t1; |
| 6 |
load data infile 't1.csv' ignore into table t2 ; |
| 7 |
Warnings: |
| 8 |
Warning 1261 Row 1 doesn't contain data for all columns |
| 9 |
Warning 1261 Row 2 doesn't contain data for all columns |
| 10 |
select * from t2; |
| 11 |
c1 c2 c3 c4 |
| 12 |
a b 1 7545402351885872315 |
| 13 |
a b 2 6048842355806993119 |
| 14 |
insert into t2 (c1,c2,c3) values ("a" , "b", 4); |
| 15 |
select * from t2; |
| 16 |
c1 c2 c3 c4 |
| 17 |
a b 1 7545402351885872315 |
| 18 |
a b 2 6048842355806993119 |
| 19 |
a b 4 15541743660496249717 |
| 20 |
drop table t1, t2; |