So another thing we can do, which hopefully we don't want to do that often, is drop a database.
Now, this is something you actually want to be quite careful with once you have databases that have
real data.
We don't at the moment, ours are completely empty so we can play around with it.
But this will remove a database entirely and all of its contents.
So drop database.
And then once again, you replace that with the name of a database that exists like soap store.
So let's try it.
I'll do it in the command line.
First, let's delete slime store.
So drop database and then I have to spell it correctly and capitalize it like that.
It says, okay, let's do a select or rather show databases.
It's no longer here.
If I go back to my workbench, slime store is right here because this is sort of out of sync.
I have to refresh.
And now we see it's gone.
If I head over to another tool DB gate, which I think I'm going to lean more on because you can actually
read the text here.
Compared to this, my SQL gives me no way of increasing this font size.
It's kind of insane anyway.
It's the same concept, right?
I've got slime store, but if I refresh, it's gone.
Okay.
So I can also drop a database from within one of these.
All I need to do.
Let's say I wanted to drop this database.
Here is write a script.
So I'm going to click the plus sign and just run drop database, pet underscore shop, put my semicolon
in there, and then I'm going to click Execute.
And it finished.
I'll refresh.
Pet shop is gone.
I refresh over here.
Pet shop is gone.
And if I do another show?
Databases, Pet shop.
Once again, it's gone.
All right, so that's how we can draw up a database.
Of course you want to be careful with that.
The next thing we need to do is use a database.
We can create empty ones, We can delete databases, but we need to use them.
And use is the actual command that we're going to use.
It's uppercase used, although it doesn't have to be uppercase, but it's another one of those SQL keywords
and then a name of a database that currently exists.
And this tells my SQL, we want to think of it as like double clicking on this database, selecting
it as what we want to be working inside of.
So we can have all these different databases.
But when it comes time to insert information or find information or delete information or create new
tables, we have to tell my SQL where we are.
So the way that we do that is use.
So let's do use chicken underscore coupe and it tells us database changed.
You selected your working in a new database.
Now how do we know that other than seeing database changed, we have this other command select database
with parentheses.
I don't use this very often, but when we're starting out, it's a great way to know that we're doing
things correctly.
I should see chicken coop and I do it says this is your current database, chicken coop.
So if I were to make a new database, create database.
How about t shop?
I don't know why everything has to be a shop, but sure, t shop and I run select database.
I'm not using that new database.
I made it, but I'm not actually working inside of it.
I have to then run use t shop.
And then it will tell me the database changed.
But if I want to know for sure what it changed to, I select database with parentheses.
Tea Shop.
Now when we're over here in workbench or in DB Gate, any of these graphical interfaces I can write
use, I can say use.
Let's refresh.
I should see t shop.
Yeah, I can say use t shop and execute this script if I wanted to.
And that's fine.
And then if I wanted to select database to prove that it's working, let's run the script again.
It says your database is t shop OC, so that's fine.
But there's actually an easier way to use a database.
It's as simple as double clicking.
So if I have a if I double click on chicken coop and I get rid of that use and I just select the database,
it says you're working with chicken coop.
So if I double click on t shop, I run the same thing.
Now it says t shop, same thing over in this DB gate.
If I select chicken coop or Let's do t shop and then I click the plus sign, I have a new script and
you'll see up here it says t shop.
So this is using t shop.
If I do select database and I run this, we see t shop, right?
If I instead went over to chicken coop.
Now this is still going to say t shop up there, but if I do chicken coop plus sign and I do the same
thing, select database.
We'll be working in one database for a lot of the course.
So it's not a big deal to change.
We don't need to change.
But if I run this, execute it says chicken coop.
All right, so that's how we can use a database.
It's like clicking into it, selecting it, telling my SQL, this is the the one database I want to
be interacting with right now.
Of course, we're not really interacting with them, but we are selecting them.
We're using them.
Next up, we're going to learn all about putting stuff in a database.