WEBVTT

00:00.210 --> 00:07.860
OK so in this video we're going to talk about how you actually create new databases in my Escudo finally.

00:08.270 --> 00:12.500
So before we go into the code let's set the stage just a little bit.

00:12.510 --> 00:20.500
Currently we have a minuscule database server represented by this box that's running on our cloud 9

00:20.520 --> 00:21.730
instance.

00:21.780 --> 00:29.320
So that's what happened when we did the Majeski well dash CTO start that started up the database server.

00:29.670 --> 00:35.190
So now the command that I'm going to show you is what allows us to create individual databases inside

00:35.200 --> 00:37.870
of the miscue database server.

00:38.250 --> 00:46.780
So hypothetically we could have a database for a dog walking up another one for a soap shop.

00:47.130 --> 00:52.100
We could have a practice database if you were just practicing some new codes some new lines of sequela

00:52.100 --> 00:58.260
you wanted to try out and maybe there's a new site database and they're all posted they're all part

00:58.260 --> 01:02.880
of the same database server but they're individual databases inside.

01:03.120 --> 01:05.660
And that's really important to understand why.

01:05.940 --> 01:09.190
Let's zoom in a little bit on two of the databases.

01:09.660 --> 01:13.430
Our dog walking app database and a soap shop database.

01:13.500 --> 01:18.420
So inside of those two databases will store various entities or different data.

01:18.600 --> 01:24.090
So in the dog walking database we'll probably need to store information about dogs and in our So Pshop

01:24.090 --> 01:27.560
database will need to store something about soaps.

01:27.690 --> 01:29.350
And then here's where it gets really important.

01:29.490 --> 01:38.250
Our dog walking app likely has users but so does our So Pshop app and our dog walking app has payments

01:38.580 --> 01:40.370
and so does our soap shop app.

01:40.740 --> 01:42.830
So they have to be separated.

01:42.990 --> 01:48.150
If we just had one database that everything was using on this server there would be a lot of crossover

01:48.150 --> 01:49.180
and there would be issues.

01:49.290 --> 01:55.190
But if you had somebody who had the same name who used your dog walking app and they also use the soap

01:55.190 --> 02:00.390
shop app and they kind of the screams got crossed if you will that's problematic.

02:00.390 --> 02:07.140
So what we're going to learn now is how to create these individual walled off databases inside of the

02:07.240 --> 02:09.050
highest of all servers we have running.

02:09.210 --> 02:09.670
OK.

02:09.720 --> 02:11.330
So let's take a look at some code.

02:11.490 --> 02:12.870
This first line here.

02:12.960 --> 02:14.380
We've already seen before.

02:14.430 --> 02:19.660
All it does is list the current databases that exist and the sequel server.

02:19.950 --> 02:29.480
So when we do it right now I need to start up I ask Well CCL Seelye and I type show databases.

02:29.550 --> 02:33.660
We get this list of the five preexisting ones that we have nothing to do with.

02:33.660 --> 02:35.430
We didn't create these manually.

02:35.460 --> 02:42.530
The next piece of code is create a database followed by the name of the database you'd like to create.

02:42.750 --> 02:50.460
So in this course whenever there's a variable all use these brackets to signify that it's just a placeholder.

02:50.580 --> 02:54.730
So in this case whatever the name of your database is and then a semi-colon.

02:54.960 --> 03:03.420
So to make a database for our soapstar we might name it soap underscore store or for our dog app we

03:03.420 --> 03:06.850
could use dog app and you don't have to use underscores.

03:06.960 --> 03:09.230
You can capitalize things if you would like.

03:09.420 --> 03:10.910
There's no rules governing that.

03:10.920 --> 03:12.040
Exactly.

03:12.060 --> 03:19.080
However if you did something like this while it can work it's just not a good idea to do it.

03:19.140 --> 03:21.360
So that gets axed out.

03:21.360 --> 03:23.280
I don't recommend doing it.

03:23.280 --> 03:26.370
Actually my recommendation is to stick with this here.

03:26.430 --> 03:27.930
What's called Snake case.

03:27.950 --> 03:33.900
Everything is lowercase and just use underscores It's that are spaces but it's totally up to you.

03:33.930 --> 03:36.000
Like I said there's not a hard rule.

03:36.090 --> 03:38.640
And what's more important is that you you're just consistent.

03:38.640 --> 03:44.250
So whatever you choose just make sure that you continue to use that just to avoid any confusion.

03:44.280 --> 03:47.070
So let's hop over to our terminal and give it a shot.

03:47.130 --> 03:49.230
So I'm going to just make my first database

03:52.670 --> 03:56.550
and I will call it hello world.

03:56.680 --> 04:05.120
DB And remember that semi-colon and if we wanted to make sure that it worked we can just run that show

04:05.120 --> 04:07.390
database's command again.

04:08.240 --> 04:10.010
Now you'll see a new addition.

04:10.190 --> 04:10.890
Hello world.

04:10.910 --> 04:12.880
D.B.

04:12.920 --> 04:14.730
A note about capitalization.

04:15.110 --> 04:20.140
When I wrote create database yes you can get away with doing create database.

04:20.420 --> 04:20.910
Hello.

04:20.920 --> 04:22.640
And let's call this one.

04:22.640 --> 04:25.640
Testing D-B.

04:26.240 --> 04:28.050
That works just fine.

04:28.400 --> 04:34.700
So whenever you see those capitalized letters in command you do not have to use them but I like to use

04:34.700 --> 04:41.000
them in a lot of people like to use them just to signify what comes from sequel and then what is a custom

04:41.000 --> 04:41.330
name.

04:41.330 --> 04:48.200
So in this case testing VB is something I wrote or hello world D-B is a database name or table name

04:48.200 --> 04:54.960
down the line or a column name once we get there and we can tell that because it's not capitalized.

04:55.520 --> 05:00.450
And then create database is in all caps tells us that just regular old equal.

05:00.870 --> 05:01.380
OK.

05:01.520 --> 05:05.770
So that's pretty much it to creating a database that doesn't really give us very much.

05:05.780 --> 05:10.870
But we've basically made a space on the server where we can add data.

05:11.120 --> 05:12.630
We just don't know how to do that yet.

05:12.740 --> 05:18.290
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

05:18.290 --> 05:20.030
example testing DB.
