{"id":3178,"date":"2014-02-15T08:38:46","date_gmt":"2014-02-15T16:38:46","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=3178"},"modified":"2023-12-28T02:19:59","modified_gmt":"2023-12-28T09:19:59","slug":"mysql-export-table-to-csv","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-export-table-to-csv\/","title":{"rendered":"MySQL Export Table to CSV"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn various techniques for exporting a MySQL table to a CSV file.<\/p>\n\n\n\n<p>The CSV stands for comma-separated values.\u00a0The CSV file format is often used to exchange data between applications such as Microsoft Excel, Open Office, Google Docs, and so on.<\/p>\n\n\n\n<p>Having data from the MySQL database in CSV file format will be useful because you can analyze and format the data in the way you want.<\/p>\n\n\n\n<p>MySQL provides an easy way to export the query\u2019s result into a CSV file that resides on the database server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1) Exporting a table to a CSV file using SELECT &#8230; INTO OUTFILE statement<\/h2>\n\n\n\n<p>We&#8217;ll illustrate how to export the orders table from the <code>classicmodels<\/code> <a href=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/mysql-sample-database\/\">sample database<\/a> into a CSV file located on the MySQL Server.<\/p>\n\n\n\n<p>First, open the Command Prompt on Windows or Terminal on Unix-like systems and connect to the MySQL server:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">mysql -u root -p<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Second, change the current database to <code>classicmodels<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">USE<\/span> classicmodels;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Third, show the value of the <code>secure_file_priv<\/code> variable:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SHOW<\/span> <span class=\"hljs-keyword\">VARIABLES<\/span> <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">\"secure_file_priv\"<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>On Windows server, the output is like the following:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">+------------------+------------------------------------------------+\r\n| Variable_name    | Value                                          |\r\n+------------------+------------------------------------------------+\r\n| secure_file_priv | C:\\ProgramData\\MySQL\\MySQL Server <span class=\"hljs-number\">8.0<\/span>\\Uploads\\ |\r\n+------------------+------------------------------------------------+\r\n<span class=\"hljs-number\">1<\/span> row <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.02 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>On Ubuntu, the output will look like:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">\r+------------------+-----------------------+\r\n| Variable_name    | Value                 |\r\n+------------------+-----------------------+\r\n| secure_file_priv | <span class=\"hljs-regexp\">\/var\/<\/span>lib\/mysql-files\/ |\r\n+------------------+-----------------------+\r\n<span class=\"hljs-number\">1<\/span> row <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.01 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>secure_file_priv<\/code> setting indicates the directory where you are allowed to store the output file.<\/p>\n\n\n\n<p>Finally, retrieve data from the <code>orders<\/code> table and export the result set into the <code>orders.csv<\/code> file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> orders\n<span class=\"hljs-keyword\">INTO<\/span> <span class=\"hljs-keyword\">OUTFILE<\/span> <span class=\"hljs-string\">'C:\/ProgramData\/MySQL\/MySQL Server 8.0\/Uploads\/orders.csv'<\/span> \n<span class=\"hljs-keyword\">FIELDS<\/span> <span class=\"hljs-keyword\">ENCLOSED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\"'<\/span> \n<span class=\"hljs-keyword\">TERMINATED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">','<\/span> \n<span class=\"hljs-keyword\">ESCAPED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\"'<\/span> \n<span class=\"hljs-keyword\">LINES<\/span> <span class=\"hljs-keyword\">TERMINATED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\\r\\n'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Notice that the <code>orders.csv<\/code> file must not exist in the directory C:\/ProgramData\/MySQL\/MySQL Server 8.0\/Uploads\/. Otherwise, the statement will issue an error:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">ERROR <span class=\"hljs-number\">1086<\/span> (HY000): File <span class=\"hljs-string\">'C:\/ProgramData\/MySQL\/MySQL Server 8.0\/Uploads\/orders.csv'<\/span> already exists<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>How it works:<\/p>\n\n\n\n<p>First, retrieve data from the <code>orders<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> orders<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Second, specify the CSV output file (orders.csv) stored in the allowed directory (C:\/ProgramData\/MySQL\/MySQL Server 8.0\/Uploads) in the INTO OUTFILE clause:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">INTO OUTFILE 'C:\/ProgramData\/MySQL\/MySQL Server 8.0\/Uploads\/orders.csv' <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"note\">Notice you have to replace the backslash <code>\\<\/code> by the forward slash <code>\/<\/code> in the directory on Windows to make it work.<\/p>\n\n\n\n<p>Third, define the format of the output file as CSV by specifying how fields and lines in the output are formatted:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">FIELDS ENCLOSED BY '\"' \nTERMINATED BY ',' \nESCAPED BY '\"' \nLINES TERMINATED BY '\\r\\n';<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Here is the detail of each option:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>FIELDS ENCLOSED BY &#8216;&#8221;&#8216;:<\/strong>  specifies that each field in the output file will be enclosed by double quotation marks (<code>\"<\/code>).<\/li>\n\n\n\n<li><strong>TERMINATED BY &#8216;,&#8217;:<\/strong>  specifies that fields in the output file are separated (terminated) by a comma (<code>,<\/code>). <\/li>\n\n\n\n<li><strong>ESCAPED BY &#8216;&#8221;&#8216;:<\/strong> specifies the character used to escape special characters. In this case, it&#8217;s a double quotation mark (<code>\"<\/code>).<\/li>\n\n\n\n<li><strong>LINES TERMINATED BY &#8216;\\r\\n&#8217;:<\/strong> specifies that each line in the output file is terminated by a carriage return (\\r) followed by a newline character (\\n), which is a common line-ending sequence in Windows environments.<\/li>\n<\/ul>\n\n\n\n<p>Here is the excerpt from the <code>orders.csv<\/code> file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-string\">\"10100\"<\/span>,<span class=\"hljs-string\">\"2003-01-06\"<\/span>,<span class=\"hljs-string\">\"2003-01-13\"<\/span>,<span class=\"hljs-string\">\"2003-01-10\"<\/span>,<span class=\"hljs-string\">\"Shipped\"<\/span>,<span class=\"hljs-string\">\"N,\"<\/span><span class=\"hljs-number\">363<\/span><span class=\"hljs-string\">\"\r\n\"<\/span><span class=\"hljs-number\">10101<\/span><span class=\"hljs-string\">\",\"<\/span><span class=\"hljs-number\">2003<\/span><span class=\"hljs-number\">-01<\/span><span class=\"hljs-number\">-09<\/span><span class=\"hljs-string\">\",\"<\/span><span class=\"hljs-number\">2003<\/span><span class=\"hljs-number\">-01<\/span><span class=\"hljs-number\">-18<\/span><span class=\"hljs-string\">\",\"<\/span><span class=\"hljs-number\">2003<\/span><span class=\"hljs-number\">-01<\/span><span class=\"hljs-number\">-11<\/span><span class=\"hljs-string\">\",\"<\/span>Shipped<span class=\"hljs-string\">\",\"<\/span>Check on availability.<span class=\"hljs-string\">\",\"<\/span><span class=\"hljs-number\">128<\/span><span class=\"hljs-string\">\"\r\n\"<\/span><span class=\"hljs-number\">10102<\/span><span class=\"hljs-string\">\",\"<\/span><span class=\"hljs-number\">2003<\/span><span class=\"hljs-number\">-01<\/span><span class=\"hljs-number\">-10<\/span><span class=\"hljs-string\">\",\"<\/span><span class=\"hljs-number\">2003<\/span><span class=\"hljs-number\">-01<\/span><span class=\"hljs-number\">-18<\/span><span class=\"hljs-string\">\",\"<\/span><span class=\"hljs-number\">2003<\/span><span class=\"hljs-number\">-01<\/span><span class=\"hljs-number\">-14<\/span><span class=\"hljs-string\">\",\"<\/span>Shipped<span class=\"hljs-string\">\",\"<\/span>N,<span class=\"hljs-string\">\"181\"<\/span>\n...<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Adding a timestamp to the CSV output file<\/h3>\n\n\n\n<p>You often need to export data into a CSV file whose name contains a timestamp indicating when the file is created. To achieve this, you need to use a <a title=\"MySQL Prepared Statement\" href=\"https:\/\/www.mysqltutorial.org\/mysql-stored-procedure\/mysql-prepared-statement\/\">MySQL prepared statement<\/a>.<\/p>\n\n\n\n<p>The following commands export the entire <code>orders<\/code> table into a CSV file with a timestamp as a part of the file name:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">set<\/span> @ts = <span class=\"hljs-keyword\">DATE_FORMAT<\/span>(<span class=\"hljs-keyword\">NOW<\/span>(),<span class=\"hljs-string\">'_%Y_%m_%d_%H_%i_%s'<\/span>);\n<span class=\"hljs-keyword\">set<\/span> @filename = <span class=\"hljs-keyword\">concat<\/span>(<span class=\"hljs-keyword\">replace<\/span>(@@secure_file_priv,<span class=\"hljs-string\">'\\\\'<\/span>,<span class=\"hljs-string\">'\/'<\/span>), <span class=\"hljs-string\">'orders'<\/span>, @ts, <span class=\"hljs-string\">'.csv'<\/span>);\n\n<span class=\"hljs-keyword\">select<\/span> @filename;\n\n<span class=\"hljs-keyword\">set<\/span> @cmd = <span class=\"hljs-keyword\">CONCAT<\/span>(<span class=\"hljs-string\">\"SELECT * FROM orders INTO OUTFILE '\"<\/span>, \n\t\t\t\t   @filename,\n\t\t\t\t   <span class=\"hljs-string\">\"' FIELDS ENCLOSED BY '\\\"<\/span><span class=\"hljs-string\">' TERMINATED BY '<\/span>,<span class=\"hljs-string\">' ESCAPED BY '<\/span>\\<span class=\"hljs-string\">\"'\"<\/span>,\n\t\t\t\t   <span class=\"hljs-string\">\"  LINES TERMINATED BY '\\r\\n';\"<\/span>);\n\n<span class=\"hljs-keyword\">prepare<\/span> <span class=\"hljs-keyword\">statement<\/span> <span class=\"hljs-keyword\">from<\/span> @cmd;\n\n<span class=\"hljs-keyword\">execute<\/span> <span class=\"hljs-keyword\">statement<\/span>;\n\n<span class=\"hljs-keyword\">deallocate<\/span> <span class=\"hljs-keyword\">prepare<\/span> <span class=\"hljs-keyword\">statement<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In these statements:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, construct a query with the current timestamp as a part of the file name.<\/li>\n\n\n\n<li>Second, prepare the statement for execution by using a <code>PREPARE<\/code> statement.<\/li>\n\n\n\n<li>Third, execute the statement by using the <code>EXECUTE<\/code> command.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a stored procedure that exports a query result into a CSV file<\/h3>\n\n\n\n<p>To simplify the process of exporting the result set of a query into a CSV file, we can create a stored procedure that generates a CSV file from a query&#8217;s result set:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">DELIMITER \/\/\n\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">PROCEDURE<\/span> ExportToCSV(\n\t<span class=\"hljs-keyword\">IN<\/span> query_text <span class=\"hljs-built_in\">TEXT<\/span>, \n    <span class=\"hljs-keyword\">IN<\/span> filename <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">255<\/span>)\n)\n<span class=\"hljs-keyword\">BEGIN<\/span>\n    <span class=\"hljs-keyword\">DECLARE<\/span> ts <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">20<\/span>);\n    <span class=\"hljs-keyword\">DECLARE<\/span> cmd <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">1000<\/span>);\n    \n    <span class=\"hljs-comment\">-- Construct the full file name<\/span>\n    <span class=\"hljs-keyword\">SET<\/span> filename = <span class=\"hljs-keyword\">CONCAT<\/span>(<span class=\"hljs-keyword\">REPLACE<\/span>(@@secure_file_priv, <span class=\"hljs-string\">'\\\\'<\/span>, <span class=\"hljs-string\">'\/'<\/span>), filename);\n\n    <span class=\"hljs-comment\">-- Construct the SQL command<\/span>\n    <span class=\"hljs-keyword\">SET<\/span> @cmd = <span class=\"hljs-keyword\">CONCAT<\/span>(\n        query_text,\n        <span class=\"hljs-string\">\" INTO OUTFILE '\"<\/span>, filename,\n        <span class=\"hljs-string\">\"' FIELDS ENCLOSED BY '\\\"<\/span><span class=\"hljs-string\">' TERMINATED BY '<\/span>,<span class=\"hljs-string\">' ESCAPED BY '<\/span>\\<span class=\"hljs-string\">\"'\"<\/span>,\n        <span class=\"hljs-string\">\"  LINES TERMINATED BY '\\r\\n';\"<\/span>\n    );\n\n\n    <span class=\"hljs-comment\">-- Prepare and execute the statement<\/span>\n    <span class=\"hljs-keyword\">PREPARE<\/span> <span class=\"hljs-keyword\">statement<\/span> <span class=\"hljs-keyword\">FROM<\/span> @cmd;\n    \n    <span class=\"hljs-keyword\">EXECUTE<\/span> <span class=\"hljs-keyword\">statement<\/span>;\n    \n    <span class=\"hljs-keyword\">DEALLOCATE<\/span> <span class=\"hljs-keyword\">PREPARE<\/span> <span class=\"hljs-keyword\">statement<\/span>;\n    \n    <span class=\"hljs-keyword\">SELECT<\/span> filename;\n<span class=\"hljs-keyword\">END<\/span> \/\/\n\nDELIMITER ;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example, you can export the <code>employees<\/code> table to <code>employees.csv<\/code> file as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CALL<\/span> ExportToCSV(\n    <span class=\"hljs-string\">'select * from employees'<\/span>, \n     <span class=\"hljs-string\">'employees.csv'<\/span>\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">+--------------------------------------------------------------+\r\n| filename                                                     |\r\n+--------------------------------------------------------------+\r\n| C:<span class=\"hljs-regexp\">\/ProgramData\/<\/span>MySQL\/MySQL Server <span class=\"hljs-number\">8.0<\/span>\/Uploads\/employees.csv  |\r\n+--------------------------------------------------------------+\r\n<span class=\"hljs-number\">1<\/span> row <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.01 sec)\r\n\r\nQuery OK, 0 rows affected (0.01 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>You can retrieve the CSV file in the output: C:\/ProgramData\/MySQL\/MySQL Server 8.0\/Uploads\/employees.csv<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Adding column heading to the CSV output file<\/h3>\n\n\n\n<p>It would be convenient if the CSV file contains the first line as the column headings so that the file is more understandable.<\/p>\n\n\n\n<p>To add the column headings, you can use a <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-union\/\">UNION<\/a> operator as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-16\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-string\">'Order no'<\/span>, <span class=\"hljs-string\">'Order date'<\/span>, <span class=\"hljs-string\">'Required Date'<\/span>, <span class=\"hljs-string\">'Shipped Date'<\/span>, <span class=\"hljs-string\">'Status'<\/span>, <span class=\"hljs-string\">'Comments'<\/span>, <span class=\"hljs-string\">'Customer No'<\/span>\n<span class=\"hljs-keyword\">UNION<\/span> \n<span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> orders\n<span class=\"hljs-keyword\">INTO<\/span> <span class=\"hljs-keyword\">OUTFILE<\/span> <span class=\"hljs-string\">'C:\/ProgramData\/MySQL\/MySQL Server 8.0\/Uploads\/orders_heading.csv'<\/span> \n<span class=\"hljs-keyword\">FIELDS<\/span> <span class=\"hljs-keyword\">ENCLOSED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\"'<\/span> \n<span class=\"hljs-keyword\">TERMINATED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">','<\/span> \n<span class=\"hljs-keyword\">ESCAPED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\"'<\/span> \n<span class=\"hljs-keyword\">LINES<\/span> <span class=\"hljs-keyword\">TERMINATED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\\r\\n'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-16\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Mapping NULL to other values<\/h3>\n\n\n\n<p>If the values in the result set contain <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-null\/\">NULL<\/a> values, the target file will contain&nbsp; <code>\"N<\/code> instead of <code>NULL<\/code>. <\/p>\n\n\n\n<p>To fix this issue, you need to replace the <code>NULL<\/code> value by another value, for example, not available ( <code>N\/A<\/code> ) by using the <a title=\"MySQL IFNULL\" href=\"https:\/\/www.mysqltutorial.org\/mysql-control-flow-functions\/mysql-ifnull\/\">IFNULL function<\/a> as shown in the following query:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-17\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-string\">'Order no'<\/span>, <span class=\"hljs-string\">'Order date'<\/span>, <span class=\"hljs-string\">'Required Date'<\/span>, <span class=\"hljs-string\">'Shipped Date'<\/span>, <span class=\"hljs-string\">'Status'<\/span>, <span class=\"hljs-string\">'Comments'<\/span>, <span class=\"hljs-string\">'Customer No'<\/span>\n<span class=\"hljs-keyword\">UNION<\/span> \n<span class=\"hljs-keyword\">SELECT<\/span> orderNumber, orderDate, requiredDate, <span class=\"hljs-keyword\">IFNULL<\/span>(shippedDate,<span class=\"hljs-string\">\"N\/A\"<\/span>), <span class=\"hljs-keyword\">status<\/span>, <span class=\"hljs-keyword\">IFNULL<\/span>(comments, <span class=\"hljs-string\">\"N\/A\"<\/span>), customerNumber \n<span class=\"hljs-keyword\">FROM<\/span> orders\n<span class=\"hljs-keyword\">INTO<\/span> <span class=\"hljs-keyword\">OUTFILE<\/span> <span class=\"hljs-string\">'C:\/ProgramData\/MySQL\/MySQL Server 8.0\/Uploads\/orders_full.csv'<\/span> \n<span class=\"hljs-keyword\">FIELDS<\/span> <span class=\"hljs-keyword\">ENCLOSED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\"'<\/span> \n<span class=\"hljs-keyword\">TERMINATED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">','<\/span> \n<span class=\"hljs-keyword\">ESCAPED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\"'<\/span> \n<span class=\"hljs-keyword\">LINES<\/span> <span class=\"hljs-keyword\">TERMINATED<\/span> <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'\\r\\n'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-17\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the <code>SELECT<\/code> clause, we replace <code>NULL<\/code> in the <code>shippedDate<\/code> and <code>comments<\/code> columns with the string <code>\"N\/A\"<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2) Exporting data to CSV file using MySQL Workbench<\/h2>\n\n\n\n<p>If you don\u2019t have access to the MySQL server to retrieve the exported CSV file, you can use MySQL Workbench to export the result set of a query to a CSV file in your local computer as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, execute a query to get its result set.<\/li>\n\n\n\n<li>Second, from the result panel, click &#8220;export recordset to an external file&#8221;. Note that a result set is also known as a recordset.<\/li>\n\n\n\n<li>Third, a new dialog is displayed and asks you for a filename and file format. Enter the file name, choose CSV as the file format, and click the Save button.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"885\" height=\"462\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV.jpg\" alt=\"MySQL Export Table to CSV\" class=\"wp-image-4970\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV.jpg 885w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV-300x157.jpg 300w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV-768x401.jpg 768w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/figure>\n\n\n\n<p>The CSV file exported by MySQL Workbench supports column headings, <code>NULL<\/code> values and other features.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the <code>SELECT ... INTO OUTFILE<\/code>  statement to export a table to a CSV file on the MySQL Server.<\/li>\n\n\n\n<li>Use MySQL Workbench to export a table to a CSV file on your local computer.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"3178\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-export-table-to-csv\/\"\n\t\t\t\tdata-post-title=\"MySQL Export Table to CSV\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"3178\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-export-table-to-csv\/\"\n\t\t\t\tdata-post-title=\"MySQL Export Table to CSV\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn various techniques of how to export MySQL table to a CSV file format.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":174,"menu_order":86,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-3178","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL Export Table to CSV<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn various techniques for exporting a MySQL table to a CSV file.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL Export Table to CSV\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn various techniques for exporting a MySQL table to a CSV file.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-28T09:19:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-export-table-to-csv\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-export-table-to-csv\\\/\",\"name\":\"MySQL Export Table to CSV\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-export-table-to-csv\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-export-table-to-csv\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2014\\\/02\\\/MySQL-Export-Table-to-CSV.jpg\",\"datePublished\":\"2014-02-15T16:38:46+00:00\",\"dateModified\":\"2023-12-28T09:19:59+00:00\",\"description\":\"In this tutorial, you will learn various techniques for exporting a MySQL table to a CSV file.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-export-table-to-csv\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-export-table-to-csv\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-export-table-to-csv\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2014\\\/02\\\/MySQL-Export-Table-to-CSV.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2014\\\/02\\\/MySQL-Export-Table-to-CSV.jpg\",\"width\":885,\"height\":462},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-export-table-to-csv\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Basics\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL Export Table to CSV\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL Export Table to CSV","description":"In this tutorial, you will learn various techniques for exporting a MySQL table to a CSV file.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/","og_locale":"en_US","og_type":"article","og_title":"MySQL Export Table to CSV","og_description":"In this tutorial, you will learn various techniques for exporting a MySQL table to a CSV file.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-12-28T09:19:59+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV.jpg","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/","url":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/","name":"MySQL Export Table to CSV","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV.jpg","datePublished":"2014-02-15T16:38:46+00:00","dateModified":"2023-12-28T09:19:59+00:00","description":"In this tutorial, you will learn various techniques for exporting a MySQL table to a CSV file.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV.jpg","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2014\/02\/MySQL-Export-Table-to-CSV.jpg","width":885,"height":462},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-export-table-to-csv\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Basics","item":"https:\/\/www.mysqltutorial.org\/mysql-basics\/"},{"@type":"ListItem","position":3,"name":"MySQL Export Table to CSV"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/3178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=3178"}],"version-history":[{"count":5,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/3178\/revisions"}],"predecessor-version":[{"id":13632,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/3178\/revisions\/13632"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/174"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=3178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}