部分**參考
資料檔案中的列數跟 mysql 資料表字段數目沒有完全匹配,並且 sql_mode 設為 strict 模式
先查詢當前的sql_mode,再設定sql_mode的模式。
show variables like 'sql_mode'
;set sql_mode=''
;
建表語句:
#①
create table `kcxxsj`(
`user_kcdm` varchar(20)
not null,
`kcmc` varchar(
100)
not null,
`jg_gh` int
not null
)engine=innodb default charset=utf8;
load data infile 'c:/programdata/mysql/mysql server 8.0/uploads/cjsj.csv'
into table kcxxsj character set gb2312
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n'
ignore 1 lines;
#②create table `cjsj`(
`kcmc` varchar(
100)
not null,
`user_kcdm` varchar(20)
not null,
`kscj` int
not null,
`khfs` varchar(10)
not null,
`kclb1` varchar(10)
,`xh` int
not null
)engine=innodb default charset=utf8;
load data infile 'c:/programdata/mysql/mysql server 8.0/uploads/cjsj.csv'
into table cjsj character set gb2312
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n'
ignore 1 lines;
#③create table `jbxx`(
`xb` int
not null,
`bjid` int
not null,
`bjdm_user` int
not null,
`xh` int
not null
)engine=innodb default charset=utf8;
load data infile 'c:/programdata/mysql/mysql server 8.0/uploads/jbxx.csv'
into table jbxx character set gb2312
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n'
ignore 1 lines;
#④create table `zyxysj`(
`user_dm` int
not null,
`zwmc` varchar(
100)
not null,
`ssyxb_userdm` int
not null
)engine=innodb default charset=utf8;
load data infile 'c:/programdata/mysql/mysql server 8.0/uploads/zyxysj.csv'
into table zyxysj character set gb2312
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n'
(`user_dm`, `zwmc`, `ssyxb_userdm` )
SQL hive建表 匯入資料
1 直接在資料庫中建立 use tmp ubtdb create table tablenamedemo field1 string comment field1 comment field2 string comment field2 comment comment table comment p...
hive建表 匯入資料 匹配
1.建表 建立非重複表,分隔符設定為 create table if not exists imei guid imei string row format delimited fields terminated by 2.匯入 將本地資料夾的資料上傳到hive,適用資料量較大情況 concaten...
hive建庫建表與資料匯入匯出
hive建表 hive分內部表與外部表,建立內部表時,會將資料移動到資料倉儲指向的路徑 若建立外部表,僅記錄資料所在的路徑,不對資料的位置做任何改變。在刪除表的時候,內部表的元資料和資料會被一起刪除,而外部表只刪除元資料,不刪除資料。這樣外部表相對來說更加安全些,資料組織也更加靈活,方便共享源資料。...