Home Database Mysql Tutorial mysql Load Data InFile 的用法_MySQL

mysql Load Data InFile 的用法_MySQL

Jun 01, 2016 pm 01:19 PM
default

bitsCN.com 首先创建一个表
Use Test;
Create Table TableTest(
`ID` mediumint(8) default '0',
`Name` varchar(100) default ''
) TYPE=MyISAM;


向数据表导入数据
Load Data InFile 'C:/Data.txt' Into Table `TableTest`


常用如下:
Load Data InFile 'C:/Data.txt' Into Table `TableTest` Lines Terminated By '/r/n';
这个语句,字段默认用制表符隔开,每条记录用换行符隔开,在Windows下换行符为“/r/n”

C:/Data.txt 文件内容如下面两行:
1 A
2 B
“1”和“A”之间有一个制表符
这样就导进两条记录了。



自定义语法
Load Data InFile 'C:/Data.txt' Into Table `TableTest` Fields Terminated By ',' Enclosed By '"' Escaped By '"' Lines Terminated By '/r/n';

Fields Terminated By ',' Enclosed By '"' Escaped By '"'
表示每个字段用逗号分开,内容包含在双引号内

Lines Terminated By '/r/n';
表示每条数据用换行符分开


和 Load Data InFile 相反的是
Select * From `TableTest` Into OutFile 'C:/Data_OutFile.txt';
把表的数据导出bitsCN.com

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to configure default gateway How to configure default gateway Dec 07, 2023 am 11:34 AM

Steps to configure default gateway: 1. Determine the IP address of the router; 2. Open the network configuration interface of the computer; 3. Configure network connection; 4. Configure IPv4 settings; 5. Enter the IP address and subnet mask; 6. Configure the default gateway ;7. Configure DNS server; 8. Save settings. Detailed introduction: 1. Determine the router's IP address. The default gateway address is usually the router's IP address. You can find the router's IP address on the back of the router or in the user manual; 2. Open the computer's network configuration, etc.

Configure default gateway Configure default gateway Dec 07, 2023 pm 03:02 PM

Steps to configure default gateway: 1. Open the control panel; 2. Select Network and Internet; 3. Configure network connection; 4. Configure IP address; 5. Configure DNS server address; 6. Confirm the configuration; 7. Restart the network device. Detailed introduction: 1. Open the Control Panel, in Windows system, click the Start menu, select "Control Panel"; 2. Select Network and Internet, in the Control Panel, select "Network and Internet"; 3. Configure network connections, etc. .

How to configure default gateway How to configure default gateway Dec 07, 2023 pm 02:56 PM

Steps to configure default gateway: 1. Understand the network environment; 2. Obtain the router IP address; 3. Log in to the router management interface; 4. Find and configure the WAN port settings; 5. Configure the default gateway; 6. Save the settings and exit; 7. Check whether the network connection is normal. Configuring the default gateway is an important step in network setup. It determines which router the host uses to access the Internet.

An in-depth analysis of the default usage of PHP: revealing its secrets for you An in-depth analysis of the default usage of PHP: revealing its secrets for you Mar 23, 2024 am 08:06 AM

PHP is a scripting language widely used in the field of web development. Developers have benefited a lot from its flexibility and powerful functions. In PHP, setting default values ​​is a common operation, and the default keyword plays a crucial role. This article will deeply analyze the usage of default in PHP, reveal its secrets for you, and combine it with specific code examples to help readers better understand. 1. Default parameter values ​​In PHP, we can set default values ​​for the parameters of a function to prevent

Does the Java keyword contain 'default'? Does the Java keyword contain 'default'? Apr 23, 2023 pm 01:13 PM

Is default a java keyword? Answer: default is a keyword in java8, also called "virtualextensionmethods". The Chinese translation is called "virtual extension method", which contains some default usage methods in the interface. When the interface is extended, it will not conflict with the implementation class code related to the interface. Introduction to default and java: 1. The previous interface was a double-edged sword, which could be oriented to abstraction but not oriented to specific programming. 2. The disadvantage of this is that when you need to modify the interface, you must first modify all classes that implement the interface. 3. When you cannot add new methods to the interface, it will not affect the existing display, so the default method is added to solve the problem for everyone.

How to implement MySQL's default constraint default and zero-fill constraint zerofill How to implement MySQL's default constraint default and zero-fill constraint zerofill May 31, 2023 pm 05:10 PM

Default constraint MySQL default value constraint is used to specify the default value of a certain column. Add default constraint method 1: default; method 2: altertable table name modify column name type default default value; createtablet_user10(idint,namevarchar(20),addressvarchar(20)default'Beijing'--specify default constraints);--altertable table name modify column name type default default value; createtablet_user11(idint,namevarchar(20),addr

How to set the default cache resolution for Tencent Video How to set the default cache resolution How to set the default cache resolution for Tencent Video How to set the default cache resolution Mar 12, 2024 pm 12:20 PM

The Tencent Video app software provides a large number of film and television videos, and popular series are updated 24 hours a day, completely bidding farewell to the film shortage. Everything you want to watch can be found immediately, and the overall viewing experience is more immersive. Open the software and enter your mobile phone number to log in online. Different types of video channels are open. You can search and watch immediately without waiting. The entire plot content is buffered in seconds. The ups and downs of the video plot make people feel more happy. Of course, the definition line can also be adjusted. Whether during playback or batch downloading, you can set the default definition with one click, making the overall viewing experience more enjoyable. Now the editor will provide detailed settings for Tencent Video users online. Ways to cache clarity. 1. Open Tencent Video and click to enter Personal

How to use php default How to use php default Mar 03, 2023 pm 07:22 PM

In PHP, the default keyword needs to be used together with the switch statement to perform different actions based on different conditions. The switch statement is a conditional selection statement. First, the case value that satisfies the condition will be found as the program entry after execution; if all cases are not satisfied, the default entry will be found. If not found, the entire switch statement will be exited. Default is an alternative entry, but for error or logic checking, the default branch should be added to the switch statement.

See all articles