{"id":125,"date":"2009-08-14T10:48:25","date_gmt":"2009-08-14T14:48:25","guid":{"rendered":"http:\/\/www.dev-notes.com\/blog\/2009\/08\/14\/inserting-multiple-records-at-once-into-a-database-table\/"},"modified":"2009-08-14T10:48:25","modified_gmt":"2009-08-14T14:48:25","slug":"inserting-multiple-records-at-once-into-a-database-table","status":"publish","type":"post","link":"https:\/\/www.dev-notes.com\/blog\/2009\/08\/14\/inserting-multiple-records-at-once-into-a-database-table\/","title":{"rendered":"Inserting multiple records at once into a database table"},"content":{"rendered":"<p>For demonstration purposes, we are going to assume that we have a table named &#8220;employees&#8221; with two fields, name and department.<\/p>\n<p><b>Oracle<\/b><\/p>\n<pre class=\"code\">\ninsert all\n  into employees (name, department) values('Aaron','Accounting')\n  into employees (name, department) values('Ibis','IT')\n  into employees (name, department) values('Mary','Marketing')\n  into employees (name, department) values('Paul','Useless')\nselect '' from dual;\n<\/pre>\n<p><b>MySQL, PostgreSQL, and SQL Server<\/b><\/p>\n<pre class=\"code\">\ninsert into employees (name, department) values\n  ('Aaron','Accounting'),\n  ('Ibis','IT'),\n  ('Mary','Marketing'),\n  ('Paul','Useless');\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This note provides a sample for how to insert multiple records into a database table with only one insert statement.  This provides a more efficient way to insert data into a table than calling multiple statements.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,20,39],"tags":[],"class_list":["post-125","post","type-post","status-publish","format-standard","hentry","category-mysql","category-oracle","category-sql-server"],"_links":{"self":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/comments?post=125"}],"version-history":[{"count":0,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/125\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/media?parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/categories?post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/tags?post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}