当前位置:网站首页>Possible problems in inserting Excel data into MySQL database
Possible problems in inserting Excel data into MySQL database
2022-07-19 12:49:00 【liliane】
1. take excel Data preservation txt file , Or manually copy to txt, By default, a tab Column interval .
2. stay mysql Create tables in the database :create table table_name ...
3. Use mysql Of load Command to import local data :
load data local infile"path" into table table_name fields terminated by '\t'; //path Is the file path ,table_name Is the name of the watch
perhaps
load data local infile"path" into table table_name("field1","field2"...); //field Is the corresponding field name
Be careful , If the inserted encoding format is incorrect , It may appear that the record is null perhaps “?” The situation of , here , Need to put txt Change the code to utf-8( Use editplus, Or notepad , adopt “ Save as ”, Set encoding ).
If you use the method of primary key self increment (auto_increment), When you import data incorrectly for the first time , Delete (delete), Re import , Will find key The value of is no longer from 1 Start ( The previous serial number has been used ). If necessary , Before re importing , adopt “alter table table_name auto_increment=1” command , To modify the auto_increment The initial value of the .
Besides , Import data , There may be format problems , If there are spaces at the beginning and end , You can use trim function :
update table_name set field = trim(field);
You can even choose to remove the left or right space ,ltrim,rtrim;
If you want to remove all spaces , You can use replace function :
update table_name set field = replace(field, ' ', '');
边栏推荐
- PostgreSQL function usage record
- 逻辑运算符1(阁瑞钛伦特软件-九耶实训)
- 10 minutes to customize the pedestrian analysis system, detection and tracking, behavior recognition, human attributes all in one!
- Analyze a ros2 cmakelists in detail Txt file
- MYCAT divides the database and table according to the hash value of the string range
- What is the relationship between softmax and cross enterprise?
- 深度学习参数初始化(二)Kaiming初始化 含代码
- 稳超胜算,历9弥新 | 2022金仓创新产品发布会顺利召开
- mysql如何删除数据表,被关联的数据表如何删除呢
- Yunxi and Tencent cloud have reached a strategic cooperation to accelerate the expansion of the global live broadcast market
猜你喜欢

R语言--Cox模型校准曲线原理(一)数据来源

S32K148_ Can drive (bare metal development)
Do you still need to release the database connection manually with typeorm

Acwing4405. 统计子矩阵

第五天笔记

Ultrasonic sensor (ch101 & ch201) - Ⅱ

ASP.NET协同OA办公服务管理平台源码

Pytorch version: yolov4 integrating attention and mobilenet

The leader of the new generation of cloud database -- AWS

Opencv tutorial 03: how to track an object in a video
随机推荐
PostgreSQL function usage record
市场“不确定性”中的投资逻辑 2020-03-18
Talk about the redis cache penetration scenario and the corresponding solutions
Yunxi focuses on store broadcast solutions to accelerate global layout
学习记录:调用TFTLCD液晶屏
What is the relationship between softmax and cross enterprise?
10分钟自定义搭建行人分析系统,检测跟踪、行为识别、人体属性All-in-One!
音频常见端子剖析图---再也不会搞错了
10 minutes to customize the pedestrian analysis system, detection and tracking, behavior recognition, human attributes all in one!
Do you still need to release the database connection manually with typeorm
運維小白成長記—架構第6周
Opencv:06 morphology
查看mysql数据表结构的两种方法你会吗?
机器学习作业1
懒到骨子里了,我在CSDN写文章都懒得自己写了,基于selenium模拟写文章
MyCat2搭建mysql主从分离
超声波传感器(CH101&ch201) - Ⅱ
电路故障的分析简略
Differences between get requests and post requests and usage examples
Redis集群主备缓存区满了导致主备频繁倒换