All right.
Next up here.
This one will be nice and short.
Always trying to figure out is how many times the average user post.
So we have a board or our investors want to know basically what our engagement is like just in general
for every user any user what how many times can we assume they've posted.
So this is just across the board and really all we need to do is take the total number of posts photos
and divide it by the total number of users.
And you could do that separately different lines or you could you know do a big joint statement between
users and photos and then use average and calculate average but you could just do it using subcommittee's
which is what I'm going to do.
So something a little different.
So we'll just to calculate average number of photos per user.
So what we're looking for is total number of photos divided by total number of users.
And the first part will each of those parts individually if we know how to do we can just do a select
count star from photos and that will give us the total number of photos.
If I had a semi-colon 257.
And then for users who just need to change that to be users like to count from users and we get 100
now forget it mental math.
Even if you're not it's easy to figure out are average in your head.
But of course we're trying to do this dynamically so that if we have X you know ten thousand more users
tomorrow this still applies.
So using stub queries basically what I can do is divide these two.
So I can't just do this I'll get a syntax error.
What we need to do.
Like we've seen before was said purpose is add parentheses around these two things.
OK but even that won't be enough.
What are we missing.
Well it's just like we can't just say five plus five.
We can't just do one divided by two.
We have to say select one to about a right to in order to get anything.
So we need an extra Select up here.
Yeah it's kind of a mess.
You know we could do this on separate lines maybe I'm not actually sure how to best format this because
it's kind of a weird query but maybe something like this.
Well we can leave it at that for now.
Now get rid of all comment that out.
Now if we run this will we get this massive line here.
But 2.5 7 so every user has 2.5 on average every user has 2.5 7 posts that's thrown off significantly
for a couple of reasons we'll see later.
There are lots of users who just don't post anything.
And if we tried to get rid of the spot our efforts would change.
So we'll get there in a moment.
What we could do is just add in a simple alias we'll just call it as average KBG.
OK.
And there we go.
So that's the answer to that one.
If you came up with another way feel free to share it and we'll talk about it in the comments.
All right.
Moving on.