OK so in this video we're going to talk about how you actually create new databases in my Escudo finally.
So before we go into the code let's set the stage just a little bit.
Currently we have a minuscule database server represented by this box that's running on our cloud 9
instance.
So that's what happened when we did the Majeski well dash CTO start that started up the database server.
So now the command that I'm going to show you is what allows us to create individual databases inside
of the miscue database server.
So hypothetically we could have a database for a dog walking up another one for a soap shop.
We could have a practice database if you were just practicing some new codes some new lines of sequela
you wanted to try out and maybe there's a new site database and they're all posted they're all part
of the same database server but they're individual databases inside.
And that's really important to understand why.
Let's zoom in a little bit on two of the databases.
Our dog walking app database and a soap shop database.
So inside of those two databases will store various entities or different data.
So in the dog walking database we'll probably need to store information about dogs and in our So Pshop
database will need to store something about soaps.
And then here's where it gets really important.
Our dog walking app likely has users but so does our So Pshop app and our dog walking app has payments
and so does our soap shop app.
So they have to be separated.
If we just had one database that everything was using on this server there would be a lot of crossover
and there would be issues.
But if you had somebody who had the same name who used your dog walking app and they also use the soap
shop app and they kind of the screams got crossed if you will that's problematic.
So what we're going to learn now is how to create these individual walled off databases inside of the
highest of all servers we have running.
OK.
So let's take a look at some code.
This first line here.
We've already seen before.
All it does is list the current databases that exist and the sequel server.
So when we do it right now I need to start up I ask Well CCL Seelye and I type show databases.
We get this list of the five preexisting ones that we have nothing to do with.
We didn't create these manually.
The next piece of code is create a database followed by the name of the database you'd like to create.
So in this course whenever there's a variable all use these brackets to signify that it's just a placeholder.
So in this case whatever the name of your database is and then a semi-colon.
So to make a database for our soapstar we might name it soap underscore store or for our dog app we
could use dog app and you don't have to use underscores.
You can capitalize things if you would like.
There's no rules governing that.
Exactly.
However if you did something like this while it can work it's just not a good idea to do it.
So that gets axed out.
I don't recommend doing it.
Actually my recommendation is to stick with this here.
What's called Snake case.
Everything is lowercase and just use underscores It's that are spaces but it's totally up to you.
Like I said there's not a hard rule.
And what's more important is that you you're just consistent.
So whatever you choose just make sure that you continue to use that just to avoid any confusion.
So let's hop over to our terminal and give it a shot.
So I'm going to just make my first database
and I will call it hello world.
DB And remember that semi-colon and if we wanted to make sure that it worked we can just run that show
database's command again.
Now you'll see a new addition.
Hello world.
D.B.
A note about capitalization.
When I wrote create database yes you can get away with doing create database.
Hello.
And let's call this one.
Testing D-B.
That works just fine.
So whenever you see those capitalized letters in command you do not have to use them but I like to use
them in a lot of people like to use them just to signify what comes from sequel and then what is a custom
name.
So in this case testing VB is something I wrote or hello world D-B is a database name or table name
down the line or a column name once we get there and we can tell that because it's not capitalized.
And then create database is in all caps tells us that just regular old equal.
OK.
So that's pretty much it to creating a database that doesn't really give us very much.
But we've basically made a space on the server where we can add data.
We just don't know how to do that yet.
So we've just partitioned off a little area and we've given it a name of hello world D-B or in our second
example testing DB.