(, zip-) null, 0.
, ( ) People.
create table People (
id int,
first_name varchar(30),
last_name varchar(50),
city varchar(50),
state varchar(50),
zip int
);
Then upload file.csvto the table People. Pay attention to the last line (starting from set), where it zipis assigned nullif the value in the file is equal ""(also like an empty line)
load data local infile '/path/to/file.csv'
into table People
fields
terminated by ','
enclosed by '"'
lines terminated by '\n'
(id, first_name, last_name, city, state, @zip)
set zip = if(@zip='', null, @zip);
source
share