Join Mark Niemann-Ross for an in-depth discussion in this video Delete records in SQLite with Python, part of Database Clinic: SQLite.
- [Instructor] Next,…I'm being asked to delete stage directions,…such as enter, exit, and others.…So, for example, in the database,…we can see Line 23 starts with Exit,…and what we'll wind up with is a removal of Line 23.…I've created a Python script to do this operation,…and we're looking at it in Python Idle.…I'm going to completely skip over…the top part of the Python script…and the bottom part of the Python script…and simply focus on the SQL…that we'll pass to the SQLite database.…
What this is doing is setting up a query.…It's a delete query.…From the table called midsummer.…And we're going to delete any lines where play_text,…which is the column that contains the actual text…that's being spoken,…starts with ENTER…or starts with EXIT…or starts with ACT…or any of these following commands.…So again, this SQL query…will delete these lines from the database.…
Let's go ahead and run that.…It comes back almost immediately.…I've jumped back now to the DB Browser for SQLite.…I'm going to refresh,…and you'll notice that things changed.…
- Strengths and weaknesses of SQLite
- Creating a database
- Joining data sets
- Calculations with SQLite and Python
- Searching a database
- Subqueries and queries in SQLite
- CRUD operations in SQLite with R
Skill Level Intermediate
1. SQLite in Five Minutes
2. Create a Database
3. Join Two Datasets
4. Search a Database
5. Create, Read, Update, and Delete Operations
6. Averages and Calculations
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.