Hi. Welcome back to model threes, people Programming
where you are currently in less than one single statements. Sub lesson One point for the update statement. Now the ah, anything about the update statement is that is very similar to the select statement, except with a few different arrangements. In the select statement, we had select field names
where conditions are true
in an update statement, it's going to be a little different. It's gonna be
set column name, too. What do you want it to be? Where conditions are true.
So it's table columns conditions,
whereas a select statement is columns, tables, conditions.
So let's go ahead and make a couple changes that we can then fix with an update statement. Now, De Beber has a neat feature that when you're working with simple queries or just a specific table in ah, in general, you can actually just edit the values. Now, if you write a really complex quarry, you won't be able to just edit the values because the beaver won't be
as commented on what exactly you're trying to edit, but with just focusing on the user's table again, which, if we filter that down,
we can see that. That's this table right here from that axiomatic a database that we imported
and we can see that we've cleared out the user's where is approved equals one
from the user table.
So we have a bunch of ones. Let's go ahead and click into the column said it to zero. It inner.
We're just gonna change a few of them to zero.
So they are now disabled
So now we click. Save
updated those for us. And if we run the statement again, we will see
These folks disappear from the query results
now in this other career that I have open,
I'm selecting where the value of is approved is zero. So we should see
folks that we just disabled should appear in this quarry
So we use D beaver to update those. We used an interface update those, but how would we write a query to update those? Well, it's not too bad. We would just click. New sequel editor,
table name. We want to update the users
So, again, we're updating this table.
We're setting this column to this value
where these conditions are true
and was going and run that
Andy burritos us. We updated four rows.
And if you go back, Thio
Well, I don't like him.
That's a different script that we go back to.
Our crew were selected. Where is approved? Zero will see that we had for,
uh, four rows of data. So now the rerun, this query, we should see that they have disappeared,
and sure enough, they have.
And if we ready ran the Cree where is approved is one. We should see
those guys pop back into the query,
and sure enough, they did.
So the update statement
can be summarized in this layout. It's update table name
set columns to the value where the conditions are true,
which is very similar to the select statement which was select columns
from the table where conditions are true.
So that brings this. Listen to a close. I hope you were able to get your updates, statements working and I will see you in the next video. Thank you.