Welcome back, everyone.
So let's show you how to delete a data entry from your database table, your model, as you can expect,
this is actually super simple.
You just called delete in the same way you called Save.
Let's head over to our code editor.
OK, so here I am again, our editor.
What I'm going to do is let's go ahead and grab the patient who is now called, I believe, jingo Carl.
So let's check this out.
When I say patient, the objects, the all.
And now we have jingo Carl.
Let's go ahead and remove him from our database.
So the first thing to do is actually grab Carl.
So lots of different ways you could do this if you wanted to.
You could use some sort of filter and then say the last name is equal to Jango.
But I already know that I can just say Carl or even like data point whatever you want to call this particular
object is patient.
The objects don't get.
And I know Carl is primary key one.
If I didn't know this primary key, I'd have to start filtering.
So I would say filter where last name is equal to Jango.
Or maybe I use something like a field lookup, you know, last name ends with or starts with Jango.
So lots of different ways I could have gotten this.
But now, if I check out data points again, you can call that variable whatever you want.
I see it's Carl.
So how do I delete this?
I simply say data points or whatever you happen to call this and treat and then call delete.
Open close parentheses obviously want to be very careful at this command because it will remove it from
the database and you need to go back and restore your database to some previously saved st.
In order to get this back.
So we hit delete and it's going to report back.
Oh, by the way, I removed from the office folder model patient index key number one.
So now if I say patient, the object's the all and run that I can see, there is no more Carl Jango.
It's just these other patients here.
OK.
So again, it's pretty simple to delete, but it's obviously command you want to be careful with.
Let's see you in the next lecture.