WEBVTT

00:00.090 --> 00:05.370
So now that we've seen how to use source we're going to take advantage of it to get some sample data

00:05.400 --> 00:09.840
going for the next couple of videos and exercises.

00:09.840 --> 00:11.650
Cats are kind of boring.

00:11.700 --> 00:13.210
They're pretty simple at this point.

00:13.230 --> 00:17.030
Name and age and breed and we need some more complicated data.

00:17.190 --> 00:19.670
And that's a little something that's a little more real world.

00:19.710 --> 00:24.090
So we're still not working with you know something straight out of a production app because we haven't

00:24.090 --> 00:27.540
seen some of the features that we need to know for that to work.

00:27.540 --> 00:33.040
So it's still kind of simplified data but what we're working with is books data.

00:33.480 --> 00:36.060
So this is what we have.

00:36.080 --> 00:42.000
I've given you this file so you can find it in the file section or if the downloadable section of this

00:42.000 --> 00:43.570
video.

00:43.680 --> 00:48.620
Basically there's two parts for creating a Books table.

00:48.930 --> 00:50.690
And I'll go over that in just a second.

00:50.760 --> 00:56.070
And then after that table is created there is a bunch of values that I'd like for you to insert and

00:56.070 --> 01:00.360
I didn't want you to have to type these all at once but I want us to all have the same data so we can

01:00.360 --> 01:03.010
be on the same page when we run exercises.

01:03.990 --> 01:07.950
So all of this data is actually real data about books from Amazon.

01:08.220 --> 01:13.620
And basically it has every book has a book ID so that should not be new.

01:14.130 --> 01:16.010
There's a title to our.

01:16.500 --> 01:20.770
Then we have an author first name and author last name.

01:21.210 --> 01:23.910
So if we look at one Here's the namesake.

01:23.910 --> 01:29.940
That's the title The author first name is Juba and her last name is Lahiri.

01:30.690 --> 01:32.670
Then we have the released year.

01:32.670 --> 01:34.540
So what year was it released.

01:34.670 --> 01:39.900
And this is an example where we're using kind of the I don't wanna say dumbed down but simplified version

01:39.900 --> 01:47.840
of data because typically you would probably store a date an actual date not just a number like 2003.

01:47.880 --> 01:50.260
So we'll see how to do that when we talk about dates.

01:50.610 --> 01:55.690
But for now we just have 2003 and then the next thing is stock quantity.

01:55.830 --> 01:58.780
And this is just an arbitrary number I picked.

01:59.040 --> 02:03.120
The idea here is that we have a fictional bookshop and we're keeping track of all the books and how

02:03.120 --> 02:04.790
many we have in stock.

02:04.800 --> 02:14.820
So for the name sake we have 32 copies in stock for a hologram for the king we have 154 copies in stock.

02:15.260 --> 02:21.080
Then the final thing is the pages how many pages are in that book so you can see some books are really

02:21.080 --> 02:29.330
long like the Amazing Adventures of Kavalier and Clay has 634 pages and some are much shorter like what

02:29.330 --> 02:32.450
we talked about when we talk about love by Raymond Carver.

02:32.690 --> 02:34.910
Really good short stories if you like short stories.

02:34.910 --> 02:37.160
176 pages.

02:37.790 --> 02:39.820
So a note about these books.

02:39.950 --> 02:44.780
I started off by just picking off the best sellers on Amazon.

02:44.810 --> 02:50.820
As of writing today so I think that's where this one Norse mythology final game came from but I then

02:50.840 --> 02:55.010
just decided to create a variety of years and page numbers.

02:55.010 --> 02:56.780
Some of my favorite authors.

02:56.870 --> 02:58.110
It's a whole mix of things.

02:58.150 --> 03:05.270
So it is real world in a sense but it's also sort of I plan certain things to work a certain way so

03:05.540 --> 03:08.650
we have certain you know we have some really long titles and some short titles.

03:08.750 --> 03:13.520
We have some really long books and short books we have some books from the 2000s and some from the 9900

03:13.910 --> 03:14.450
and so on.

03:14.450 --> 03:18.060
Basically I wanted a variety of things that we could practice with.

03:18.110 --> 03:23.960
So go ahead create a file in cloud nine and put all of this in there.

03:23.990 --> 03:25.230
Now if you want to type it go ahead.

03:25.250 --> 03:29.640
But I would recommend that you don't just say that you don't accidently mess something up.

03:29.660 --> 03:31.630
We want our data to be consistent.

03:32.180 --> 03:37.000
So go ahead copy it make a new file and then we need to execute that file.

03:37.400 --> 03:42.860
And I want to make a new database right now if we do select database.

03:43.190 --> 03:52.190
We're working with cat app I want to create a database and we'll call it bookshop and then use bookshop

03:53.240 --> 03:54.730
and we should have a blank slate.

03:54.920 --> 04:00.460
If we do show tables there should be nothing here.

04:00.770 --> 04:01.840
Perfect.

04:01.880 --> 04:07.410
So what you want to do is make sure this file has been saved and then we just execute it.

04:07.430 --> 04:10.100
So it's a pretty straightforward source.

04:10.700 --> 04:15.280
And then you need to make sure you either are referencing the correct path.

04:15.290 --> 04:19.640
So in my case I'm running my CFI and my root directory.

04:20.030 --> 04:23.960
So all I have to do is book data as well whatever you call it.

04:24.020 --> 04:25.130
You don't need to refer to.

04:25.490 --> 04:29.990
I recommend just putting in the main directory for now but we could you know you could have a separate

04:29.990 --> 04:31.170
folder if you wanted to.

04:31.310 --> 04:34.240
And you just need to refer to it correctly anyways.

04:34.430 --> 04:38.730
Source Book data as well.

04:39.200 --> 04:40.750
And here we go.

04:40.760 --> 04:41.660
All right.

04:41.660 --> 04:48.030
First thing we get this message and that tells us the create table worked and then we get 16 rows affected.

04:48.050 --> 04:50.900
And that tells us the Insearch statement worked.

04:50.960 --> 04:56.220
So let's just verify those do describe books.

04:56.260 --> 04:56.960
Here we go.

04:57.110 --> 04:59.850
Here's all that we created in that table.

05:00.250 --> 05:06.940
And let's just do a simple select start from books and you can see it's pretty messy.

05:07.390 --> 05:08.750
And that's still a bit.

05:08.770 --> 05:10.130
We're going to work on ways.

05:10.300 --> 05:13.990
We're going to see ways of refining this and making things shorter.

05:13.990 --> 05:16.070
Collapsing data and so on.

05:16.090 --> 05:21.580
So that's all we're doing in this video just getting set up now that we have it in there and our database

05:21.680 --> 05:24.390
will be able to work with it and be on the same page.

05:24.400 --> 05:24.830
Awesome.
