Puspender Tanwar wrote:means, \r\n is used for pointing the cursor to the starting of new line ?
Essentially, yes. But in this case you do not have a cursor on a screen, because you are reading a stream of characters from a file. In this example, the text within the file is presumably structured as a series of lines, so you need to know when the current "line" of incoming characters ends and the new one begins. If the file was in a binary format e.g. an image, it would not contain text "lines" at all.
Puspender Tanwar wrote:don't we do this using \n in windows ?
I don't do much of this kind of thing on Windows, but it probably depends on how the text file was created e.g. if the file came from Unix originally then it may only have "\n" or it may have been converted to use "\r\n" for Windows. When you move files between Windows and Unix, this is one of the things that can cause problems. Also, different tools may be able to handle this for you automatically if they know which OS they are running on. In this case it looks like you need to tell MySQL explicitly how to recognise the end of a "line" in the incoming stream of data.
Puspender Tanwar wrote:and what this whole statement means LINES TERMINATED BY '\r\n';
This means exactly what it says:
Load some data...
.. from a local input file called '/path/pet.txt'...
... into a table called 'pet'...
... and each incoming line ends with '\r\n'.
This file is probably in CSV format, which is commonly used for tabular data in flat files, although it's not explicitly stated here.
The
MySQL documentation should help you with the details here.