{"id":171940,"date":"2026-01-28T03:53:46","date_gmt":"2026-01-28T02:53:46","guid":{"rendered":"https:\/\/liora.io\/en\/?p=171940"},"modified":"2026-08-08T12:44:25","modified_gmt":"2026-08-08T11:44:25","slug":"sql-delete-how-do-i-use-this-query","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/sql-delete-how-do-i-use-this-query","title":{"rendered":"SQL DELETE: How do I use this query?"},"content":{"rendered":"\n<p><strong>One of the must-have SQL queries is DELETE. And with good reason: this command lets you delete rows of data. But how do you use SQL DELETE? Let&#8217;s find out in this article.\n<\/strong><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-sql-delete\">What is SQL DELETE?<\/h2>\n\n\n<p>To guarantee the quality and reliability of the data in a table, it is often necessary to delete one or more items of data (either because they are false, obsolete, erroneous, inadequate, etc.). To this end, you can use the <a href=\"https:\/\/liora.io\/en\/sql-tutorial-top-5-most-useful-methods\">SQL<\/a> DELETE query. This command allows you to delete all records you no longer need.<\/p>\n\n\n<p>Good to know: before deleting anything from a database or table, we recommend that you perform a backup. Once a DELETE request has been launched, there&#8217;s no going back. So if you want to recover data that has been inadvertently deleted, it&#8217;s best to have a backup.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"how-do-i-use-sql-delete-to-delete-data\">How do I use SQL DELETE to delete data?<\/h2>\n\n\n<p>The syntax for deleting data from a table is as follows:<\/p>\n\n\n<p>DELETE FROM `table`<br\/>WHERE condition<\/p>\n\n\n<p>And to help you better understand the use of SQL DELETE, we&#8217;ve put together a number of concrete application cases. To this end, we use the &#8220;Client&#8221; table below:<\/p>\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table>\n<colgroup>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<\/colgroup>\n<thead>\n<tr>\n<th>ID<\/th>\n<th>Vorname<\/th>\n<th>Nachname<\/th>\n<th>Stadt<\/th>\n<th>Alter<\/th>\n<th>E-Mail<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>Justin<\/td>\n<td>Martin<\/td>\n<td>Paris<\/td>\n<td>29<\/td>\n<td>justinemartin@gmail.com<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Thomas <\/td>\n<td>Durant<\/td>\n<td>Bordeaux<\/td>\n<td>35<\/td>\n<td>tomtom@sfr.fr<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Marie<\/td>\n<td>Leroy<\/td>\n<td>Angers<\/td>\n<td>27<\/td>\n<td>marieleroy@laposte.net<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>Vanessa<\/td>\n<td>Savary<\/td>\n<td>Marseille<\/td>\n<td>32<\/td>\n<td>vanessa13@gmail.com<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n<h3 class=\"wp-block-heading\" id=\"delete-a-single-line\">Delete a single line<\/h3>\n\n\n<p>If you wish to delete a single line, simply register the following query:<\/p>\n\n\n<p>DELETE FROM `Client`<br\/>WHERE `id` = 2<\/p>\n\n\n<p>In this example, we&#8217;ve deleted the row in the Customer table corresponding to ID 2. Here&#8217;s the result:<\/p>\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table>\n<colgroup>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<\/colgroup>\n<thead>\n<tr>\n<th>ID<\/th>\n<th>Vorname<\/th>\n<th>Nachname<\/th>\n<th>Stadt<\/th>\n<th>Alter<\/th>\n<th>E-Mail<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>Justin<\/td>\n<td>Martin<\/td>\n<td>Paris<\/td>\n<td>29<\/td>\n<td>justinemartin@gmail.com<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Thomas <\/td>\n<td>Durant<\/td>\n<td>Bordeaux<\/td>\n<td>35<\/td>\n<td>tomtom@sfr.fr<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Marie<\/td>\n<td>Leroy<\/td>\n<td>Angers<\/td>\n<td>27<\/td>\n<td>marieleroy@laposte.net<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>Vanessa<\/td>\n<td>Savary<\/td>\n<td>Marseille<\/td>\n<td>32<\/td>\n<td>vanessa13@gmail.com<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/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=\"https:\/\/liora.io\/en\/courses\/data-ai\/data-analyst\">Learn how to use SQL DELETE<\/a><\/div><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"delete-several-lines\">Delete several lines<\/h3>\n\n\n<p>You can easily delete several lines if they have common characteristics.<\/p>\n\n\n<p>For example, delete all customers over 30 years old.<\/p>\n\n\n<p>Here&#8217;s the query:<\/p>\n\n\n<p>DELETE FROM `Customer`<br\/>WHERE ` ge` &gt; &#8217;30&#8217;<\/p>\n\n\n<p>And the result:<\/p>\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table>\n<colgroup>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<\/colgroup>\n<thead>\n<tr>\n<th>ID<\/th>\n<th>Vorname<\/th>\n<th>Nachname<\/th>\n<th>Stadt<\/th>\n<th>Alter<\/th>\n<th>E-Mail<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>Justin<\/td>\n<td>Martin<\/td>\n<td>Paris<\/td>\n<td>29<\/td>\n<td>justinemartin@gmail.com<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Marie<\/td>\n<td>Leroy<\/td>\n<td>Angers<\/td>\n<td>27<\/td>\n<td>marieleroy@laposte.net<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n<p>As a reminder, the WHERE clause allows you to specify the table rows you wish to delete.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"delete-all-data\">Delete all data<\/h3>\n\n\n<p>The syntax is as follows:<\/p>\n\n\n<p>DELETE FROM `tableau`<\/p>\n\n\n<p>Simply remove the WHERE conditional clause to remove all data from your table.<\/p>\n\n\n<p>Good to know: instead of the DELETE request, you can also use the TRUNCATE command. The operation is identical, with one difference: if there is an auto-increment, the TRUNCATE query resets it. This is not the case with the DELETE command.<\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"delete-rows-between-two-datasets\">Delete rows between two datasets<\/h3>\n\n\n<p>The DELETE query can be used in conjunction with <a href=\"https:\/\/liora.io\/en\/sql-developer-what-is-it-whats-it-for\">other SQL commands<\/a>. In this example, we also show you the BETWEEN and AND queries. The idea is to delete the lines between two other lines. For example, between lines 1 and 4.<\/p>\n\n\n<p>The syntax is as follows<\/p>\n\n\n<p>DELETE FROM Client WHERE id BETWEEN 1 AND 4.<\/p>\n\n\n<p>Here&#8217;s the result:<\/p>\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table>\n<colgroup>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<col\/>\n<\/colgroup>\n<thead>\n<tr>\n<th>ID<\/th>\n<th>Pr\u00e9nom<\/th>\n<th>Nom<\/th>\n<th>Ville<\/th>\n<th>\u00c2ge<\/th>\n<th>Email<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>Justin<\/td>\n<td>Martin<\/td>\n<td>Paris<\/td>\n<td>29<\/td>\n<td>justinemartin@gmail.com<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>Vanessa<\/td>\n<td>Savary<\/td>\n<td>Marseille<\/td>\n<td>32<\/td>\n<td>vanessa13@gmail.com<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n<p>These are just a few simplified examples. In reality, the SQL DELETE command has many applications. If you&#8217;d like to learn more, join our training program.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"join-the-liora-training-course-to-learn-more-about-sql-language\">Join the Liora training course to learn more about SQL language<\/h2>\n\n\n<p><a href=\"https:\/\/liora.io\/en\/sql-joins-everything-you-need-to-know-about\">Mastering SQL is one of the fundamentals<\/a> for any data expert or developer. But between updates, deletions, additions&#8230; you need to know a multitude of SQL queries.<br\/>That&#8217;s why we offer training courses at Liora. In addition to the <a href=\"https:\/\/liora.io\/en\/all-about-non-relational-databases\">SQL DELETE<\/a> command, you&#8217;ll learn all the queries that are essential for handling a relational database.<\/p>\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=\"https:\/\/liora.io\/en\/courses\/data-ai\/data-engineer\">Discover Liora&#8217;s training courses<\/a><\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p><strong>One of the must-have SQL queries is DELETE. And with good reason: this command lets you delete rows of data. But how do you use SQL DELETE? Let&#8217;s find out in this article.<br \/>\n<\/strong><\/p>\n","protected":false},"author":78,"featured_media":171942,"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-171940","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\/171940","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\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=171940"}],"version-history":[{"count":4,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/171940\/revisions"}],"predecessor-version":[{"id":209939,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/171940\/revisions\/209939"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/171942"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=171940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=171940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}