VOOZH about

URL: https://www.geeksforgeeks.org/python/python-sqlite-deleting-data-in-table/

⇱ Python SQLite - Deleting Data in Table - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python SQLite - Deleting Data in Table

Last Updated : 1 Jul, 2025

Deleting data in SQLite is achieved using the DELETE statement, which can optionally be combined with a WHERE clause to specify which rows to delete.

Syntax

DELETE FROM table_name [WHERE Clause]

  • table_name: The name of the table from which you want to delete data.
  • WHERE condition: This is optional. It specifies the condition for which rows to delete. If omitted, all rows will be deleted from the table.

First, we need to create a database and table to demonstrate DELETE clause, here's how we can do it:

Output:

👁 Image

Deleting Data from the Table

Now let's look at how to delete data from the GEEK table. We'll cover two examples: deleting specific rows based on a condition and deleting all rows.

Example 1: Delete Rows with Condition

In this example, we'll delete rows where the Score is less than 15.

Output:

👁 Image

Example 2: Delete All Rows

In this example, we'll delete all the rows from the GEEK table.

Output:

👁 Image
Comment
Article Tags:
Article Tags: