{"id":3923,"date":"2025-06-06T20:32:00","date_gmt":"2025-06-06T20:32:00","guid":{"rendered":"https:\/\/w3buddy.com\/?post_type=cposts&#038;p=3923"},"modified":"2025-06-07T09:56:39","modified_gmt":"2025-06-07T09:56:39","slug":"sql-insert","status":"publish","type":"cposts","link":"https:\/\/w3buddy.com\/blog\/notes\/sql\/sql-insert\/","title":{"rendered":"SQL INSERT"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <code>INSERT<\/code> statement is used to <strong>add new records<\/strong> into a table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd39 Basic Syntax<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><code>-- Insert values into all columns (must match order)\nINSERT INTO employees \nVALUES (101, 'John Doe', 'IT', 60000);\n\n-- Insert into specific columns\nINSERT INTO employees (employee_id, name, salary)\nVALUES (102, 'Jane Smith', 75000);<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd39 Insert Multiple Rows (MySQL, PostgreSQL, SQL Server)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><code>INSERT INTO employees (employee_id, name, salary)\nVALUES \n  (103, 'Alice', 65000),\n  (104, 'Bob', 70000);<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd39 Oracle Note (INSERT ALL)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><code>-- Oracle: multi-row insert\nINSERT ALL\n  INTO employees (employee_id, name, salary) VALUES (105, 'Karan', 67000)\n  INTO employees (employee_id, name, salary) VALUES (106, 'Priya', 72000)\nSELECT * FROM dual;<\/code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udde0 Quick Recap<\/h2>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th>Feature<\/th><th>Syntax Example<\/th><\/tr><\/thead><tbody><tr><td>Insert full row<\/td><td><code>INSERT INTO table VALUES (...)<\/code><\/td><\/tr><tr><td>Insert with columns<\/td><td><code>INSERT INTO table (col1, col2) VALUES (...)<\/code><\/td><\/tr><tr><td>Multiple rows<\/td><td><code>INSERT INTO table (...) VALUES (...), (...)<\/code><\/td><\/tr><tr><td>Oracle multi-insert<\/td><td><code>INSERT ALL ... SELECT * FROM dual;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 Use <code>INSERT<\/code> to populate your table with fresh data<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The INSERT statement is used to add new records into a table. \ud83d\udd39 Basic Syntax \ud83d\udd39 Insert Multiple Rows (MySQL, PostgreSQL, SQL Server) \ud83d\udd39 Oracle Note (INSERT ALL) \ud83e\udde0 Quick Recap Feature Syntax Example Insert full row INSERT INTO table VALUES (&#8230;) Insert with columns INSERT INTO table (col1, col2) VALUES (&#8230;) Multiple rows INSERT [&hellip;]<\/p>\n","protected":false},"template":"","meta":{"googlesitekit_rrm_CAowu461DA:productID":""},"categories":[952,979],"class_list":["post-3923","cposts","type-cposts","status-publish","hentry","category-notes","category-sql"],"_links":{"self":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts\/3923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts"}],"about":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/types\/cposts"}],"wp:attachment":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/media?parent=3923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/categories?post=3923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}