{"id":193878,"date":"2025-03-03T06:30:00","date_gmt":"2025-03-03T05:30:00","guid":{"rendered":"https:\/\/liora.io\/en\/?p=193878"},"modified":"2026-08-07T10:24:28","modified_gmt":"2026-08-07T09:24:28","slug":"managing-table-data-in-sql","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/managing-table-data-in-sql","title":{"rendered":"Managing Table Data: INSERT, UPDATE, DELETE with SQL"},"content":{"rendered":"\n<p><strong>Tables store data that can be used or referenced in the future. Over time, it is common to modify this data to ensure it remains relevant and up-to-date. In this article, you will learn three essential SQL commands to modify data: UPDATE, INSERT, and DELETE.<\/strong><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"update-changing-existing-data\"><strong>UPDATE: Changing Existing Data<\/strong><\/h2>\n\n\n<p>The UPDATE statement allows you to modify existing records in a table.<\/p>\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<p>Imagine you have a <strong>Product Information Table (<\/strong><strong>product_info<\/strong><strong>)<\/strong> for your kitchenware business. This table contains details about all products, including attributes such as product_id, product_name, weight, material, fabrication_country, cost, and price.<\/p>\n\n\n<p><strong>Before Update:<\/strong><\/p>\n\n\n<figure class=\"wp-block-image size-full\" style=\"margin-top:32px;margin-bottom:32px\"><img alt=\"Illustration for UPDATE: Changing Existing Data\" decoding=\"async\" height=\"152\" loading=\"lazy\" sizes=\"(max-width: 1102px) 100vw, 1102px\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image3-2.webp\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image3-2.webp 1102w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image3-2-300x41.webp 300w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image3-2-1024x141.webp 1024w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image3-2-768x106.webp 768w\" style=\"width:100%;height:auto\" width=\"1102\"\/><\/figure>\n\n\n<p>If the cost of borosilicate glass, used in your glass baking pan, increases, you need to update the cost data for this specific product.<\/p>\n\n\n<p><strong>SQL Script:<\/strong><\/p>\n\n\n<p>UPDATE product_info<\/p>\n\n\n<p>SET cost = cost * 1.25<\/p>\n\n\n<p>WHERE product_name = &#8216;baking pan&#8217; AND material = &#8216;glass&#8217;;<\/p>\n\n\n<p><strong>After Update:<\/strong><\/p>\n\n\n<figure class=\"wp-block-image size-full\" style=\"margin-top:32px;margin-bottom:32px\"><img alt=\"Illustration for UPDATE: Changing Existing Data\" decoding=\"async\" height=\"152\" loading=\"lazy\" sizes=\"(max-width: 1102px) 100vw, 1102px\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image1-2.webp\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image1-2.webp 1102w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image1-2-300x41.webp 300w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image1-2-1024x141.webp 1024w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image1-2-768x106.webp 768w\" style=\"width:100%;height:auto\" width=\"1102\"\/><\/figure>\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center wp-container-core-buttons-is-layout-5ee10de4\" style=\"margin-top:32px;margin-bottom:32px\"><div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"\/en\/courses\/data-ai\/data-scientist\">Master SQL for data science<\/a><\/div><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"insert-adding-new-data\"><strong>INSERT: Adding New Data<\/strong><\/h2>\n\n\n<p>The INSERT statement allows you to add new records to a table.<\/p>\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<p>As environmental concerns grow, sustainable materials are becoming popular. You decide to introduce a new baking pan made of <strong>carbon steel<\/strong>, which is durable, versatile, and heat-tolerant. You can use INSERT to add this new product to your table.<\/p>\n\n\n<p><strong>Before Insert:<\/strong><\/p>\n\n\n<p><strong>SQL Script:<\/strong><\/p>\n\n\n<p>INSERT INTO product_info (product_id, product_name, weight, material, fabrication_country, cost, price)<\/p>\n\n\n<p>VALUES (235, &#8216;baking pan&#8217;, 0.25, &#8216;carbon steel&#8217;, &#8216;France&#8217;, 9, 16);<\/p>\n\n\n<p><strong>After Insert:<\/strong><\/p>\n\n\n<figure class=\"wp-block-image size-full\" style=\"margin-top:32px;margin-bottom:32px\"><img alt=\"Illustration for INSERT: Adding New Data\" decoding=\"async\" height=\"200\" loading=\"lazy\" sizes=\"(max-width: 1138px) 100vw, 1138px\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image6-2.webp\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image6-2.webp 1138w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image6-2-300x53.webp 300w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image6-2-1024x180.webp 1024w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image6-2-768x135.webp 768w\" style=\"width:100%;height:auto\" width=\"1138\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"delete-removing-data\"><strong>DELETE: Removing Data<\/strong><\/h2>\n\n\n<p>The DELETE statement allows you to remove records from a table.<\/p>\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<p>Due to global supply chain disruptions, you decide to discontinue a <strong>stoneware baking pan<\/strong>. To remove it from your product catalog, use the DELETE statement.<\/p>\n\n\n<p><strong>Before Delete:<\/strong><\/p>\n\n\n<figure class=\"wp-block-image size-full\" style=\"margin-top:32px;margin-bottom:32px\"><img alt=\"Illustration for DELETE: Removing Data\" decoding=\"async\" height=\"198\" loading=\"lazy\" sizes=\"(max-width: 1138px) 100vw, 1138px\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image5-2.webp\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image5-2.webp 1138w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image5-2-300x52.webp 300w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image5-2-1024x178.webp 1024w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image5-2-768x134.webp 768w\" style=\"width:100%;height:auto\" width=\"1138\"\/><\/figure>\n\n\n<p><strong>SQL Script:<\/strong><\/p>\n\n\n<p>DELETE FROM product_info<\/p>\n\n\n<p>WHERE product_name = &#8216;baking pan&#8217; AND material = &#8216;stoneware&#8217;;<\/p>\n\n\n<p><strong>After Delete:<\/strong><\/p>\n\n\n<figure class=\"wp-block-image size-full\" style=\"margin-top:32px;margin-bottom:32px\"><img alt=\"Illustration for DELETE: Removing Data\" decoding=\"async\" height=\"150\" loading=\"lazy\" sizes=\"(max-width: 1104px) 100vw, 1104px\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image4-2.webp\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image4-2.webp 1104w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image4-2-300x41.webp 300w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image4-2-1024x139.webp 1024w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2025\/02\/image4-2-768x104.webp 768w\" style=\"width:100%;height:auto\" width=\"1104\"\/><\/figure>\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center wp-container-core-buttons-is-layout-5ee10de4\" style=\"margin-top:32px;margin-bottom:32px\"><div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"\/en\/courses\/data-ai\/data-scientist\">Learn more about SQL<\/a><\/div><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\"><strong>Conclusion<\/strong><\/h2>\n\n\n<p>Understanding how to modify data in SQL is crucial for maintaining accurate and up-to-date databases. Here\u2019s a quick recap:<\/p>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>UPDATE<\/strong> modifies existing records.<\/li>\n<li><strong>INSERT<\/strong> adds new records.<\/li>\n<li><strong>DELETE<\/strong> removes records from a table.<\/li>\n<\/ul>\n\n\n<p>Mastering these commands will help you manage databases efficiently and keep your data relevant!<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Tables store data that can be used or referenced in the future. Over time, it is common to modify this data to ensure it remains relevant and up-to-date. In this article, you will learn three essential SQL commands to modify data: UPDATE, INSERT, and DELETE. UPDATE: Changing Existing Data The UPDATE statement allows you to [&hellip;]<\/p>\n","protected":false},"author":99,"featured_media":193880,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[2433],"class_list":["post-193878","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/193878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/99"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=193878"}],"version-history":[{"count":5,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/193878\/revisions"}],"predecessor-version":[{"id":209739,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/193878\/revisions\/209739"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/193880"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=193878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=193878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}