{"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-02-06T07:36:02","modified_gmt":"2026-02-06T06:36:02","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":"<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>\t\t\n\t\t\t<h2 class=\"wp-block-heading\" id=\"h-what-is-sql-delete\">What is SQL DELETE?<\/h2>\t\t\n\t\t<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><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>\t\t\n\t\t\t<h2 class=\"wp-block-heading\" id=\"h-how-do-i-use-sql-delete-to-delete-data\">How do I use SQL DELETE to delete data?<\/h2>\t\t\n\t\t<p>The syntax for deleting data from a table is as follows:<\/p><p>DELETE FROM `table`<br>WHERE condition<\/p><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>\t\t\n\t\t\t<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-8806{background-color:#6434fc;border-color:inherit;color:#efefef;text-align:center;vertical-align:top}\n.tg .tg-baqh{text-align:center;vertical-align:top}\n.tg .tg-c3ow{border-color:inherit;text-align:center;vertical-align:top}\n.tg .tg-mw77{background-color:#6434fc;color:#efefef;text-align:center;vertical-align:top}\n<\/style>\n<table style=\"undefined;table-layout: fixed; width: 700px\">\n<colgroup>\n<col style=\"width: 25px\">\n<col style=\"width: 125px\">\n<col style=\"width: 125px\">\n<col style=\"width: 125px\">\n<col style=\"width: 100px\">\n<col style=\"width: 200px\">\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>\n\t\t\t<h3 class=\"wp-block-heading\" id=\"h-delete-a-single-line\">Delete a single line<\/h3>\t\t\n\t\t<p>If you wish to delete a single line, simply register the following query:<\/p><p>DELETE FROM `Client`<br>WHERE `id` = 2<\/p><p>In this example, we&#8217;ve deleted the row in the Customer table corresponding to ID 2. Here&#8217;s the result:<\/p>\t\t\n\t\t\t<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-8806{background-color:#6434fc;border-color:inherit;color:#efefef;text-align:center;vertical-align:top}\n.tg .tg-baqh{text-align:center;vertical-align:top}\n.tg .tg-c3ow{border-color:inherit;text-align:center;vertical-align:top}\n.tg .tg-mw77{background-color:#6434fc;color:#efefef;text-align:center;vertical-align:top}\n<\/style>\n<table style=\"undefined;table-layout: fixed; width: 700px\">\n<colgroup>\n<col style=\"width: 25px\">\n<col style=\"width: 125px\">\n<col style=\"width: 125px\">\n<col style=\"width: 125px\">\n<col style=\"width: 100px\">\n<col style=\"width: 200px\">\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>\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Learn how to use SQL DELETE<\/a><\/div><\/div>\n\n\t\t\t<h3 class=\"wp-block-heading\" id=\"h-delete-several-lines\">Delete several lines<\/h3>\t\t\n\t\t<p>You can easily delete several lines if they have common characteristics.<\/p><p>For example, delete all customers over 30 years old.<\/p><p>Here&#8217;s the query:<\/p><p>DELETE FROM `Customer`<br>WHERE ` ge` &gt; &#8217;30&#8217;<\/p><p>And the result:<\/p>\t\t\n\t\t\t<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-8806{background-color:#6434fc;border-color:inherit;color:#efefef;text-align:center;vertical-align:top}\n.tg .tg-baqh{text-align:center;vertical-align:top}\n.tg .tg-c3ow{border-color:inherit;text-align:center;vertical-align:top}\n.tg .tg-mw77{background-color:#6434fc;color:#efefef;text-align:center;vertical-align:top}\n<\/style>\n<table style=\"undefined;table-layout: fixed; width: 700px\">\n<colgroup>\n<col style=\"width: 25px\">\n<col style=\"width: 125px\">\n<col style=\"width: 125px\">\n<col style=\"width: 125px\">\n<col style=\"width: 100px\">\n<col style=\"width: 200px\">\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>\n\t\t<p>As a reminder, the WHERE clause allows you to specify the table rows you wish to delete.<\/p>\t\t\n\t\t\t<h3 class=\"wp-block-heading\" id=\"h-delete-all-data\">Delete all data<\/h3>\t\t\n\t\t<p>The syntax is as follows:<\/p><p>DELETE FROM `tableau`<\/p><p>Simply remove the WHERE conditional clause to remove all data from your table.<\/p><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>\t\t\n\t\t\t<h3 class=\"wp-block-heading\" id=\"h-delete-rows-between-two-datasets\">Delete rows between two datasets<\/h3>\t\t\n\t\t<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><p>The syntax is as follows<\/p><p>DELETE FROM Client WHERE id BETWEEN 1 AND 4.<\/p><p>Here&#8217;s the result:<\/p>\t\t\n\t\t\t<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-8806{background-color:#6434fc;border-color:inherit;color:#efefef;text-align:center;vertical-align:top}\n.tg .tg-baqh{text-align:center;vertical-align:top}\n.tg .tg-c3ow{border-color:inherit;text-align:center;vertical-align:top}\n.tg .tg-mw77{background-color:#6434fc;color:#efefef;text-align:center;vertical-align:top}\n<\/style>\n<table style=\"undefined;table-layout: fixed; width: 700px\">\n<colgroup>\n<col style=\"width: 25px\">\n<col style=\"width: 125px\">\n<col style=\"width: 125px\">\n<col style=\"width: 125px\">\n<col style=\"width: 100px\">\n<col style=\"width: 200px\">\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>\t\t\n\t\t<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>\t\t\n\t\t\t<h2 class=\"wp-block-heading\" id=\"h-join-the-datascientest-training-course-to-learn-more-about-sql-language\">Join the Liora training course to learn more about SQL language<\/h2>\t\t\n\t\t<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>\t\t\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Discover Liora&#8217;s training courses<\/a><\/div><\/div>\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":2,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/171940\/revisions"}],"predecessor-version":[{"id":205438,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/171940\/revisions\/205438"}],"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}]}}