create database test1;
use test1;
show tables;
drop table salgrade;
create table salgrade
(
empid varchar(10) primary key ,
sal float default 0,
comm float default 0
);
alter table salgrade modify losal int8;
alter table salgrade modify hisal int8;
desc salgrade;
load data infile "C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/employee.txt"
into table salgrade
fields terminated by ',' ; #从第二行开始导入
select * from salgrade;
truncate salgrade;
数据以EXCEL建立表格,然后另存为.CSV格式,在文本中内容如下
epid,sal,comm
smith,800.13,500
allen,1600.62,300
ward,1250,500
运行提示错误Error Code: 1265. Data truncated for column 'sal' at row 1