In this video learn how to delete records from SQLite. Annyce covers how to provide the selection criteria for the records you want deleted, as well as ensuring no records are left orphaned when associated records are removed.
- [Instructor] Deleting records in SQLite…is very similar to modifying them.…Let's say we want to delete all records…in our users table that are active.…We would start by setting up our selection criteria.…Recall that this is just a string that contains…there where portion of our SQL statement.…Next, we would execute the delete method.…Passing in the table name, the selection string,…and, in this case, null, as we don't have any placeholders…in our selection string that we will want to replace.…
Let's say this is our state before we execute the deletion.…Once the previous code is run, this will leave us with only…one record, Joe, as he's the only user in the table…who is not active.…One thing to keep in mind is that if you have…multiple tables associated with each other,…you will need to handle removing all of the records…in each table by yourself.…Otherwise, you will end up with orphaned records…and that's just sad.…
You can, however, configure SQLite to notify you…when you make changes that violate…your foreign key relationships.…
To begin, Annyce Davis reviews using the de facto data persistence solution available on Android: SQLite. She takes you through basic SQLite concepts—such as how to create a database wrapper and insert data into a table—as well as a few more advanced topics. Next, she covers working with Cupboard, an open-source project dedicated to simplifying your SQLite interactions. To wrap up, she dives into working with Realm, an object database solution designed with mobile devices in mind. Throughout the course, Annyce discusses establishing relationships between database tables, creating and running queries, as well as performing data migrations.
- Overview of SQLite
- Defining a database table's schema
- Exploring SQLite create table syntax
- Executing create table statements
- Inserting data with a foreign key relation
- Inspecting the database using a terminal
- Updating and deleting records
- Working with Cupboard
- Working with Realm
Skill Level Intermediate
Android App Development: Unit Testingwith James P White2h 59m Intermediate
1. SQLite Basics
2. SQLite Beyond the Basics
3. Working with Cupboard
4. Realm Basics
5. Realm Beyond the Basics
- 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.