Load data to your table : Import Export Data « MySQL Utilities « MySQL Tutorial

Home
MySQL Tutorial
1.Introduction
2.Select Query
3.Database
4.Table
5.Table Join
6.Subquery
7.Insert Update Delete
8.Logic Operator
9.View
10.Data Types
11.Procedure Function
12.Cursor
13.Trigger
14.Date Time Functions
15.Comparison Functions Operators
16.Aggregate Functions
17.Cast Functions Operators
18.Control Flow Functions
19.Encryption Compression Functions
20.Information Functions
21.Math Numeric Functions
22.Miscellaneous Functions
23.String Functions
24.Regular Expressions
25.Data Dictionary
26.MySQL Utilities
27.Privilege
MySQL Tutorial » MySQL Utilities » Import Export Data 
26.2.4.Load data to your table

Create a text file myTable.txt containing one record per line.

The values are separated by tabs.

The order should be consistant with the columns listed in the CREATE TABLE statement.

For NULL values, use \N (backslash, capital-N).

For example:

1        firstName    lastName    M      \N      1997-12-09

To load the text file myTable.txt into the myTable table, use this command:

mysql> LOAD DATA LOCAL INFILE 'c:\\myTable.txt' INTO TABLE myTable LINES TERMINATED BY '\r\n';


mysql>
26.2.Import Export Data
26.2.1.Turn Exporting and Importing Data on
26.2.2.Exporting Data
26.2.3.Importing data
26.2.4.Load data to your table
26.2.5.LOAD DATA INFILE into a table
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.