{"id":7957,"date":"2019-08-28T19:28:53","date_gmt":"2019-08-29T02:28:53","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=7957"},"modified":"2023-12-26T23:30:10","modified_gmt":"2023-12-27T06:30:10","slug":"mysql-insert-multiple-rows","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-multiple-rows\/","title":{"rendered":"MySQL Insert Multiple Rows"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use a single MySQL <code>INSERT<\/code> statement to insert multiple rows into a table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL INSERT multiple rows statement<\/h2>\n\n\n\n<p>To insert multiple rows into a table, you use the following form of the <code>INSERT<\/code> statement:<\/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\"><span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> table_name (column_list) \n<span class=\"hljs-keyword\">VALUES<\/span> \n  (value_list_1), \n  (value_list_2),\n   ... \n  (value_list_n);<\/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>In this syntax:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, specify the name of the table where you want to insert multiple rows after the <code>INSERT INTO<\/code> keywords.<\/li>\n\n\n\n<li>Second, list the columns in the table into which you want to insert data. This column list is optional, but if provided, you should provide corresponding values for each column in the <code>VALUES<\/code> value.<\/li>\n\n\n\n<li>Third, specify a comma-separated list of row data after the <code>VALUES<\/code> keyword. Each item on the list represents a row. The number of values in each item must be the same as the number of columns in the <code>column_list<\/code>.<\/li>\n<\/ul>\n\n\n\n<p class=\"note\">Note that to insert rows from a query into a table, you use the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-into-select\/\">INSERT INTO &#8230; SELECT<\/a> statement.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MySQL INSERT multiple rows limit<\/h3>\n\n\n\n<p>In theory, you can insert any number of rows using a single <code>INSERT<\/code> statement.<\/p>\n\n\n\n<p>However, when the MySQL server receives an <code>INSERT<\/code> statement whose size is bigger than the value specified by the <code>max_allowed_packet<\/code> option, it issues a <code>packet too large<\/code> error and terminates the connection.<\/p>\n\n\n\n<p>This statement shows the current value of the <code>max_allowed_packet<\/code> variable:<\/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\">SHOW<\/span> <span class=\"hljs-keyword\">VARIABLES<\/span> <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'max_allowed_packet'<\/span>;<\/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>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">+--------------------+----------+\n| Variable_name      | Value    |\n+--------------------+----------+\n| max_allowed_packet | <span class=\"hljs-number\">67108864<\/span> |\n+--------------------+----------+\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-3\"><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 number in the <code>Value<\/code> column is the number of bytes. Note that the value in your database server may be different.<\/p>\n\n\n\n<p>To set a new value for the <code>max_allowed_packet<\/code> variable, you use the <code>SET GLOBAL<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" 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> <span class=\"hljs-keyword\">GLOBAL<\/span> max_allowed_packet=<span class=\"hljs-keyword\">size<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><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 this statement, the <code>size<\/code> is an integer that represents the number of the maximum allowed packet size in bytes.<\/p>\n\n\n\n<p>Notice that the <code>max_allowed_packet<\/code> does not impact the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-into-select\/\">INSERT INTO .. SELECT<\/a><\/code> statement. The <code>INSERT INTO .. SELECT<\/code> statement can insert as many rows as you want.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL INSERT multiple rows examples<\/h2>\n\n\n\n<p>Let&#8217;s take some examples of using the <code>INSERT<\/code> multiple rows statement.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1) Insert multiple rows into a table<\/h3>\n\n\n\n<p>First, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-database\/\">create a new table<\/a> called <code>projects<\/code> for the demonstration:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> projects(\n  project_id <span class=\"hljs-built_in\">INT<\/span> AUTO_INCREMENT, \n  <span class=\"hljs-keyword\">name<\/span> <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">100<\/span>) <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>, \n  start_date <span class=\"hljs-built_in\">DATE<\/span>, \n  end_date <span class=\"hljs-built_in\">DATE<\/span>, \n  PRIMARY <span class=\"hljs-keyword\">KEY<\/span>(project_id)\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><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, insert two rows into the <code>projects<\/code> table using the <code>INSERT<\/code> multiple rows statement:<\/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\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> projects(<span class=\"hljs-keyword\">name<\/span>, start_date, end_date) \n<span class=\"hljs-keyword\">VALUES<\/span> \n  (<span class=\"hljs-string\">'AI for Marketing'<\/span>, <span class=\"hljs-string\">'2019-08-01'<\/span>, <span class=\"hljs-string\">'2019-12-31'<\/span>), \n  (<span class=\"hljs-string\">'ML for Sales'<\/span>, <span class=\"hljs-string\">'2019-05-15'<\/span>, <span class=\"hljs-string\">'2019-11-20'<\/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>MySQL issued the following message:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">Query OK, 2 rows affected (0.01 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><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>The output indicates that the statement has inserted two rows into the <code>projects<\/code> table successfully.<\/p>\n\n\n\n<p>Third, retrieve data from the <code>projects<\/code> table to verify the inserts:<\/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> projects;<\/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>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">+------------+------------------+------------+------------+\r\n| project_id | name             | start_date | end_date   |\r\n+------------+------------------+------------+------------+\r\n|          <span class=\"hljs-number\">1<\/span> | AI <span class=\"hljs-keyword\">for<\/span> Marketing | <span class=\"hljs-number\">2019<\/span><span class=\"hljs-number\">-08<\/span><span class=\"hljs-number\">-01<\/span> | <span class=\"hljs-number\">2019<\/span><span class=\"hljs-number\">-12<\/span><span class=\"hljs-number\">-31<\/span> |\r\n|          <span class=\"hljs-number\">2<\/span> | ML <span class=\"hljs-keyword\">for<\/span> Sales     | <span class=\"hljs-number\">2019<\/span><span class=\"hljs-number\">-05<\/span><span class=\"hljs-number\">-15<\/span> | <span class=\"hljs-number\">2019<\/span><span class=\"hljs-number\">-11<\/span><span class=\"hljs-number\">-20<\/span> |\r\n+------------+------------------+------------+------------+\r\n<span class=\"hljs-number\">2<\/span> rows <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><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<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"323\" height=\"58\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-Insert-multiple-rows-example.png\" alt=\"MySQL Insert multiple rows example\" class=\"wp-image-7958\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-Insert-multiple-rows-example.png 323w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-Insert-multiple-rows-example-200x36.png 200w\" sizes=\"auto, (max-width: 323px) 100vw, 323px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">2) Using the LAST_INSERT_ID() function<\/h3>\n\n\n\n<p>When you insert multiple rows and use the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-functions\/mysql-last_insert_id\/\">LAST_INSERT_ID()<\/a><\/code> function to get the last inserted id of an <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-auto_increment\/\">AUTO_INCREMENT<\/a><\/code> column, you will get the id of the first inserted row, not the id of the last inserted row. For example: <\/p>\n\n\n\n<p>First, insert three rows into the projects table:<\/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\"><span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> projects(<span class=\"hljs-keyword\">name<\/span>, start_date, end_date) \n<span class=\"hljs-keyword\">VALUES<\/span> \n  (<span class=\"hljs-string\">'NeuroSynthIQ'<\/span>, <span class=\"hljs-string\">'2023-12-01'<\/span>, <span class=\"hljs-string\">'2024-12-31'<\/span>), \n  (<span class=\"hljs-string\">'QuantumMind Explorer'<\/span>, <span class=\"hljs-string\">'2023-05-15'<\/span>, <span class=\"hljs-string\">'2024-12-20'<\/span>), \n  (<span class=\"hljs-string\">'SentientBot Assistant'<\/span>, <span class=\"hljs-string\">'2023-05-15'<\/span>,<span class=\"hljs-string\">'2024-10-20'<\/span>);<\/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>Second, retrieve data from the projects table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" 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> projects;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><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-12\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">+------------+-----------------------+------------+------------+\r\n| project_id | name                  | start_date | end_date   |\r\n+------------+-----------------------+------------+------------+\r\n|          <span class=\"hljs-number\">1<\/span> | AI <span class=\"hljs-keyword\">for<\/span> Marketing      | <span class=\"hljs-number\">2019<\/span><span class=\"hljs-number\">-08<\/span><span class=\"hljs-number\">-01<\/span> | <span class=\"hljs-number\">2019<\/span><span class=\"hljs-number\">-12<\/span><span class=\"hljs-number\">-31<\/span> |\r\n|          <span class=\"hljs-number\">2<\/span> | ML <span class=\"hljs-keyword\">for<\/span> Sales          | <span class=\"hljs-number\">2019<\/span><span class=\"hljs-number\">-05<\/span><span class=\"hljs-number\">-15<\/span> | <span class=\"hljs-number\">2019<\/span><span class=\"hljs-number\">-11<\/span><span class=\"hljs-number\">-20<\/span> |\r\n|          <span class=\"hljs-number\">3<\/span> | NeuroSynthIQ          | <span class=\"hljs-number\">2023<\/span><span class=\"hljs-number\">-12<\/span><span class=\"hljs-number\">-01<\/span> | <span class=\"hljs-number\">2024<\/span><span class=\"hljs-number\">-12<\/span><span class=\"hljs-number\">-31<\/span> |\r\n|          <span class=\"hljs-number\">4<\/span> | QuantumMind Explorer  | <span class=\"hljs-number\">2023<\/span><span class=\"hljs-number\">-05<\/span><span class=\"hljs-number\">-15<\/span> | <span class=\"hljs-number\">2024<\/span><span class=\"hljs-number\">-12<\/span><span class=\"hljs-number\">-20<\/span> |\r\n|          <span class=\"hljs-number\">5<\/span> | SentientBot Assistant | <span class=\"hljs-number\">2023<\/span><span class=\"hljs-number\">-05<\/span><span class=\"hljs-number\">-15<\/span> | <span class=\"hljs-number\">2024<\/span><span class=\"hljs-number\">-10<\/span><span class=\"hljs-number\">-20<\/span> |\r\n+------------+-----------------------+------------+------------+\r\n<span class=\"hljs-number\">5<\/span> rows <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><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>Third, get the last inserted id:<\/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\"><span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-keyword\">LAST_INSERT_ID<\/span>();<\/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>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">+------------------+\n| LAST_INSERT_ID() |\n+------------------+\n|                <span class=\"hljs-number\">3<\/span> |\n+------------------+\n<span class=\"hljs-number\">1<\/span> row <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><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 output shows that the <code>LAST_INSERT_ID()<\/code> returns the id of the first row in the three rows, not the id of the last row.<\/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 MySQL <code>INSERT<\/code> statement to insert multiple rows into a table.<\/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=\"7957\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-multiple-rows\/\"\n\t\t\t\tdata-post-title=\"MySQL Insert Multiple Rows\"\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=\"7957\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-multiple-rows\/\"\n\t\t\t\tdata-post-title=\"MySQL Insert Multiple Rows\"\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 how to use a single MySQL INSERT statement to insert multiple rows into a table.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":174,"menu_order":53,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-7957","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 Insert Multiple Rows By Practical Examples<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use a single MySQL INSERT statement to insert multiple rows into a table.\" \/>\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-insert-multiple-rows\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL Insert Multiple Rows By Practical Examples\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use a single MySQL INSERT statement to insert multiple rows into a table.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-27T06:30:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-Insert-multiple-rows-example.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-insert-multiple-rows\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-insert-multiple-rows\\\/\",\"name\":\"MySQL Insert Multiple Rows By Practical Examples\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-insert-multiple-rows\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-insert-multiple-rows\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/MySQL-Insert-multiple-rows-example.png\",\"datePublished\":\"2019-08-29T02:28:53+00:00\",\"dateModified\":\"2023-12-27T06:30:10+00:00\",\"description\":\"In this tutorial, you will learn how to use a single MySQL INSERT statement to insert multiple rows into a table.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-insert-multiple-rows\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-insert-multiple-rows\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-insert-multiple-rows\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/MySQL-Insert-multiple-rows-example.png\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/MySQL-Insert-multiple-rows-example.png\",\"width\":323,\"height\":58,\"caption\":\"MySQL Insert multiple rows example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-insert-multiple-rows\\\/#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 Insert Multiple Rows\"}]},{\"@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 Insert Multiple Rows By Practical Examples","description":"In this tutorial, you will learn how to use a single MySQL INSERT statement to insert multiple rows into a table.","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-insert-multiple-rows\/","og_locale":"en_US","og_type":"article","og_title":"MySQL Insert Multiple Rows By Practical Examples","og_description":"In this tutorial, you will learn how to use a single MySQL INSERT statement to insert multiple rows into a table.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-12-27T06:30:10+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-Insert-multiple-rows-example.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/","url":"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/","name":"MySQL Insert Multiple Rows By Practical Examples","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-Insert-multiple-rows-example.png","datePublished":"2019-08-29T02:28:53+00:00","dateModified":"2023-12-27T06:30:10+00:00","description":"In this tutorial, you will learn how to use a single MySQL INSERT statement to insert multiple rows into a table.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-Insert-multiple-rows-example.png","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-Insert-multiple-rows-example.png","width":323,"height":58,"caption":"MySQL Insert multiple rows example"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-insert-multiple-rows\/#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 Insert Multiple Rows"}]},{"@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\/7957","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=7957"}],"version-history":[{"count":4,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/7957\/revisions"}],"predecessor-version":[{"id":13531,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/7957\/revisions\/13531"}],"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=7957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}