1
00:00:00,180 --> 00:00:03,240
So we've been looking at the existing built in databases.

2
00:00:03,240 --> 00:00:04,530
It's not very exciting.

3
00:00:04,830 --> 00:00:08,610
Well, this may not be all that exciting either, but this is a step in the right direction.

4
00:00:08,610 --> 00:00:11,130
We're going to learn how to create new databases.

5
00:00:11,130 --> 00:00:13,140
So these will be an empty database.

6
00:00:13,140 --> 00:00:18,590
It's just like an empty bubble that we then will put our database information inside of.

7
00:00:18,600 --> 00:00:22,370
But all that it starts out as is an empty shell that has a name.

8
00:00:22,380 --> 00:00:27,720
So the way that this works, by the way, the syntax that I've written here, any time you see this

9
00:00:27,720 --> 00:00:33,510
in these slides, these angle brackets mean you replace this with your own name so you don't actually

10
00:00:33,510 --> 00:00:34,800
write those brackets.

11
00:00:34,800 --> 00:00:41,730
So create database and then pet store or soap store or dog app.

12
00:00:41,730 --> 00:00:48,480
Now in terms of how you name these, you want to come up with something unique that is obvious.

13
00:00:48,480 --> 00:00:54,330
You're not going to be typing this all that much honestly, compared to the names of the entities inside

14
00:00:54,330 --> 00:00:55,380
the databases.

15
00:00:55,380 --> 00:00:58,680
But it should be an obvious name that makes sense, right?

16
00:00:58,680 --> 00:00:59,760
It should be meaningful.

17
00:01:00,330 --> 00:01:03,990
You technically can put spaces, but it can cause problems.

18
00:01:03,990 --> 00:01:05,730
So I highly recommend against it.

19
00:01:05,730 --> 00:01:09,000
You won't really see anybody put spaces in them, so just don't.

20
00:01:09,000 --> 00:01:14,820
But you can use underscores what we would call snake case or camel casing uppercase letters for each

21
00:01:14,820 --> 00:01:15,030
word.

22
00:01:15,030 --> 00:01:15,810
It doesn't matter.

23
00:01:16,530 --> 00:01:18,840
You just want to come up with a name that makes sense.

24
00:01:18,840 --> 00:01:24,930
Now, in terms of the capitalization here, this also doesn't actually matter, but this is really common

25
00:01:24,930 --> 00:01:25,410
in SQL.

26
00:01:25,410 --> 00:01:26,910
We'll see this all over the place.

27
00:01:27,090 --> 00:01:34,020
Basically, you capitalize all the SQL keywords like create and database that are always the same,

28
00:01:34,020 --> 00:01:40,680
and then that helps it stand out from your content like the name so you don't have to.

29
00:01:40,680 --> 00:01:44,250
I'll show both, but you probably should just to make it easier.

30
00:01:44,250 --> 00:01:45,810
So I'm going to make a new database.

31
00:01:45,810 --> 00:01:48,420
I'll make a couple create database.

32
00:01:48,420 --> 00:01:52,380
I'm going to do it from the command line first in my MySQL Shell create database.

33
00:01:52,380 --> 00:01:56,640
Let's call this, I don't know, pet shop just like that.

34
00:01:56,640 --> 00:02:03,570
Now again, I need the semicolon and if I forget it, that's okay, because my prompt sort of reminds

35
00:02:03,570 --> 00:02:04,830
me, it's waiting.

36
00:02:04,950 --> 00:02:06,120
That's what that arrow means.

37
00:02:06,120 --> 00:02:10,949
It doesn't say my SQL, it's just an arrow again, it's sort of like, okay, what else?

38
00:02:10,949 --> 00:02:11,940
Hurry up, finish.

39
00:02:11,940 --> 00:02:13,290
I'm going to hit semicolon.

40
00:02:13,290 --> 00:02:13,890
Enter.

41
00:02:13,890 --> 00:02:16,140
And it doesn't matter that it was on a separate line.

42
00:02:16,290 --> 00:02:20,580
My SQL doesn't care about how we break up our commands across lines.

43
00:02:20,910 --> 00:02:26,430
So this works and you'll see I get a message query OC one row affected.

44
00:02:26,430 --> 00:02:32,850
And if I now run my show databases command, I can just use the up arrow to cycle through commands I've

45
00:02:32,850 --> 00:02:40,200
run and I'll see I have a pet shop database OC So simple enough, let's just do one more.

46
00:02:40,200 --> 00:02:45,510
I'm going to clear my screen create this time I won't do it uppercase just so you can see it still works.

47
00:02:45,510 --> 00:02:46,680
Create database.

48
00:02:47,250 --> 00:02:49,560
How about a slime store?

49
00:02:49,560 --> 00:02:50,610
We sell slime.

50
00:02:50,760 --> 00:02:55,200
Let's do uppercase here Slime store, and then I'll put my semicolon there.

51
00:02:55,200 --> 00:03:00,300
And if I do show databases and this time I'll do this in all caps as well, just to show you.

52
00:03:00,990 --> 00:03:03,960
We see slime store alongside Pet Shop.

53
00:03:03,960 --> 00:03:09,540
So we have these two empty containers now that eventually shortly we'll put data inside of.

54
00:03:09,780 --> 00:03:12,500
Now let's hop over to the workbench.

55
00:03:12,510 --> 00:03:14,490
I found a way to increase the font.

56
00:03:14,520 --> 00:03:21,390
It's kind of a pain, but what I'm going to do here is show you that first off, on the left side,

57
00:03:21,390 --> 00:03:27,510
I have a list of databases that the workbench knows about and it should know about these databases I

58
00:03:27,510 --> 00:03:29,310
just made, but it doesn't.

59
00:03:29,340 --> 00:03:30,960
I have to tell it to refresh.

60
00:03:30,960 --> 00:03:33,300
So there's a button right here to refresh it.

61
00:03:33,660 --> 00:03:36,720
And now I see Pet Shop and Slime store.

62
00:03:36,750 --> 00:03:38,490
Let me see if I can make this larger.

63
00:03:38,550 --> 00:03:41,220
Well, I just spent like 5 minutes googling.

64
00:03:41,220 --> 00:03:47,460
There's no way to change the interface font size over here, so I'll just have to zoom in in post-production.

65
00:03:47,460 --> 00:03:53,790
But as you can see now, when I refreshed, I have two new databases that are showing up or two.

66
00:03:53,820 --> 00:03:54,690
They're not new.

67
00:03:54,690 --> 00:03:59,880
They were created over here, but their names are showing up Pet shop and slime store.

68
00:04:00,270 --> 00:04:05,040
And I could create a database from within here if I wanted to create database.

69
00:04:06,000 --> 00:04:06,540
I don't know.

70
00:04:06,540 --> 00:04:07,470
What should we call this one?

71
00:04:07,470 --> 00:04:09,360
How about chicken coop?

72
00:04:10,050 --> 00:04:11,130
Just like that.

73
00:04:11,130 --> 00:04:13,020
And then I hit this lightning bolt.

74
00:04:13,020 --> 00:04:17,160
It runs this script, and down here I get a response.

75
00:04:17,160 --> 00:04:18,510
It said, That worked.

76
00:04:18,510 --> 00:04:21,240
One row affected create database chicken coop.

77
00:04:21,240 --> 00:04:25,320
And if I refresh, we now see chicken coop show up here.

78
00:04:25,590 --> 00:04:27,120
I go back to this side.

79
00:04:27,120 --> 00:04:29,850
If I do the same thing, show databases.

80
00:04:29,850 --> 00:04:31,560
We now have chicken coop.

81
00:04:31,560 --> 00:04:37,350
So once again, just confirmation that we're working in the same world, just two different sort of

82
00:04:37,350 --> 00:04:38,220
portals into it.

83
00:04:38,220 --> 00:04:43,980
One is the terminal, the other is this my SQL workbench, which this is really a tiny font.

84
00:04:43,980 --> 00:04:45,540
I got to figure something else out.

85
00:04:45,540 --> 00:04:48,630
Anyway, that is how we create databases.

86
00:04:48,630 --> 00:04:49,620
They're empty shells.

87
00:04:49,620 --> 00:04:51,120
They're a husk of a database.

88
00:04:51,120 --> 00:04:55,680
The next thing we need to do is delete them and learn how to use them.

