WEBVTT

00:00.140 --> 00:02.940
All righty then it's a little enthusiastic.

00:03.330 --> 00:07.770
Well next up we're going to talk about summer which is another built in function.

00:07.770 --> 00:12.350
It doesn't it sounds like I know I say that a lot but it's some to gather data.

00:12.840 --> 00:14.010
It adds things together.

00:14.460 --> 00:15.420
Very exciting.

00:15.470 --> 00:17.370
It actually is pretty useful.

00:17.370 --> 00:21.780
You can do things like I don't know some together all the profits all the sales that you've made or

00:22.380 --> 00:24.700
your entire payroll for a given month.

00:24.780 --> 00:28.630
Let's say you can find some important information using.

00:28.890 --> 00:32.880
For instance you might want to sum all the pages in our entire database.

00:33.060 --> 00:37.210
So this is following the same pattern as the last couple of videos have.

00:37.410 --> 00:41.340
We're going to show you how to use this function on its own without good.

00:41.550 --> 00:45.040
And then I'll show you at the end of the video how to use it with Group.

00:45.630 --> 00:46.580
So OK.

00:46.680 --> 00:49.320
Some All the pages in the entire database.

00:49.320 --> 00:50.180
It's pretty simple.

00:50.310 --> 00:54.370
It's just a select some pages.

00:56.740 --> 01:02.430
From books and it tells us six thousand six hundred twenty three.

01:02.430 --> 01:03.630
And that's all there is.

01:03.840 --> 01:09.200
We could do silly things like some go way Siri.

01:09.720 --> 01:18.510
All right we're back so we could do something silly like a select some released year and that's just

01:18.510 --> 01:22.310
going to add together all the years in our database.

01:25.510 --> 01:29.200
Let's see thirty seven thousand nine hundred ninety six.

01:29.200 --> 01:31.720
Very important insight we just gained.

01:32.070 --> 01:32.570
OK.

01:32.620 --> 01:36.360
So that's all there is to something things on it don't.

01:36.380 --> 01:40.070
Now let's see how we use it in conjunction with GROUP BY.

01:40.260 --> 01:43.160
It works the same way as what we've seen before.

01:43.180 --> 01:50.680
Basically we group things together by whatever let's say author or I don't know year and then we select

01:50.680 --> 01:57.460
what we want and we can use some to help a select so select all the pages or some all the pages each

01:57.460 --> 01:58.250
author has written.

01:58.300 --> 02:05.230
Let's see who which author cumulative cumulatively has written the most number of pages.

02:05.680 --> 02:13.690
So we'll start with a select and those two are the same thing with the with author F. name author L.

02:13.690 --> 02:14.180
name.

02:14.260 --> 02:17.740
And then we'll some pages.

02:18.160 --> 02:27.570
So we'll do that from books and then we need our all important group by author F. name author.

02:27.700 --> 02:33.120
Actually you need to do l name first and then FDM just like that.

02:34.500 --> 02:41.680
And you can see looks like Dave Eggers has the most 1293.

02:41.680 --> 02:49.090
Raymond Carver 1:53 John Steinbeck only has one book so it's only 181 pages and that's pretty much it.

02:49.090 --> 02:56.110
To some at this point we could of course do the same thing with let's say adding the released year for

02:56.110 --> 02:56.930
their books.

02:58.160 --> 03:05.810
Also a very insightful piece of information that we need but we can see people who have multiple books

03:06.380 --> 03:07.770
like Raymond Carver.

03:07.830 --> 03:12.600
There's multiple years added together Yep that's pretty much it.

03:12.760 --> 03:14.660
OK so that's some I guess said.

03:14.680 --> 03:16.310
You may end up using it if you're.

03:16.380 --> 03:16.970
I don't know.

03:17.050 --> 03:23.690
Dealing with sales data or payroll any sort of information where you're summarizing things.

03:23.930 --> 03:31.130
Actually I just used it recently when I was compiling my taxes.

03:31.360 --> 03:39.310
Probably going to bore you to death of this but I have a whole I have a database that has sales data

03:39.340 --> 03:46.960
for every week for one of my projects I have going on and I just wanted to figure out exactly in a given

03:46.960 --> 03:53.890
year how many cells or not how many but how many dollars I had sold in that entire year and just add

03:53.920 --> 03:55.510
all those values together.

03:55.600 --> 04:02.130
I didn't want to manually enter them into a calculator so it was just a matter of using Select sum and

04:02.150 --> 04:07.900
actually did a select some with a group by because I grouped by year because of sales going back.

04:07.900 --> 04:10.430
I think 2016 15 and 14.

04:10.570 --> 04:14.440
So I only want in 2016 for my tax season anyways.

04:14.440 --> 04:15.490
If you're still there.

04:15.490 --> 04:17.040
Thanks for making it through that.

04:17.150 --> 04:20.190
And our taxes are not the most interesting subject.

04:20.470 --> 04:24.530
But yeah some can be useful sometimes.

04:24.850 --> 04:26.410
And now that was just bad.
