A comma-separated values (CSV) file is a simple file format that is widely supported, so it is often used to move tabular data between different computer programs that support the format. CSV file is a text format for a database table. Each record in the table is one line of the text file. Each field value of a record is separated from the next with a comma. For example, a CSV file might be used to transfer information from a database to a spreadsheet or another database. Of course, there are more advanced formats to store data, for example, XML, but CSV does have one advantage over XML. CSV has much lower overhead, thereby using much less bandwidth and storage than XML.
Now let’s analyse how one can save data from a MySQL table to a CSV file.