

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How MySQL evaluates the blank line between two lines written in the text file while importing that text file into MySQL table?
Suppose if there is a blank line between two line written in the text file then MySQL evaluates it as the data line while importing that text file into MySQL table. It can be understood with the help of the following example −
Example
Suppose we are having a blank line between two lines in a text file named ‘A.txt’ as follows −
105,Chum,USA,11000 106,Danny,AUS,12000
Now we can write the following query to import the data from text file into MySQL table −
mysql> LOAD DATA LOCAL INFILE 'd:\A.txt' INTO table employee10_tbl FIELDS TERMINATED BY ','; Query OK, 3 rows affected, 4 warnings (0.05 sec) Records: 3 Deleted: 0 Skipped: 0 Warnings: 4
The above query shows that 3 rows have been uploaded with 4 warnings. Now, with the help of the following query we can see what has been uploaded −
mysql> Select * from employee10_tbl; +------+----------------+----------+--------+ | Id | Name | Country | Salary | +------+----------------+----------+--------+ | 105 | Chum | USA | 11000 | | 0 | NULL | NULL | NULL | | 106 | Danny | AUS | 12000 | +------+----------------+----------+--------+ 3 rows in set (0.00 sec)
The above result set shows that MySQL evaluates the blank line between two lines as the data value and uploads NULL and 0 in the columns.
- Related Questions & Answers
- How can we upload the changed value, rather than written in a text file, of column(s) while importing that text file into MySQL table?
- How MySQL evaluates if we use any other escape character rather that back-slash (\) in a text file while importing the data from text file to MySQL table?
- What is the use of escape character (\) in text file while importing the data from text file to MySQL table?
- How can we import the text file, having some line prefixes, into MySQL table?
- How MySQL evaluates the statement written on different lines?
- What kind of settings can we do to a text file by query while exporting the values from MySQL table into a text file?
- How can we import only specific columns from the text file, into MySQL table?
- How can we export all the data from MySQL table into a text file?
- How can we import the text file, having data on the same line with a separator, into MySQL table?
- How can we export some field(s) from MySQL table into a text file?
- Change the file extension in the text column in MySQL?
- Table type while importing data from flat file in SAP HANA
- How to write multiple lines in text file using Python?
- Counting number of lines in text file using java
- Java program to delete duplicate lines in text file
Advertisements