Learn to utilize the incredibly powerful and useful database tool, Microsoft's SQL Server as well as SQL Server Management Studio through this series of tutorials! This episode covers using the min, max, and avg funcitons in SQL to find extrema of datasets and manipulate it for useful purposes. Find minimums, maximums or averages of complex data sets with these easy built in functions!
Learn the basics of a standard Select, From, Where statement query in just minutes! SQL is an incredible tool for any employee to be familiar with for their job or as an independent software developer!
If you want to see anything specific on the channel or have technical questions about anything leave a comment on our of our videos and we will get back as soon as we can!
Thanks for watching and supporting the channel!
hello welcome back to the channel uh
today's episode will be the next video
in our introduction to sql tutorial
series and today we'll be taking a look
at selecting min max and average
functions inside sql
so we've already taken a look at
constructing basic queries and creating
tables and putting data inside of them
so if that's something that you're
uncomfortable with thus far i would
suggest checking out some of the earlier
videos
and without further ado let's get into
it so right now we're just we have a
blanket statement for selecting all data
out of the employee table and what we're
going to look at today is a few useful
um
a few useful sql built-in functions that
can help tell you some mathematical
statistics about your functionality
so as i look at this let's say we want
to see
the maximum salary
from our salary table so
we would use sql's built in select
max and then you put the column name in
here so max salary
from the employee table and then what
this is going to do is go through and
get the maximum salary that on its own
is not that useful because now you're
just looking at a number and you don't
have any data
so it's
important to alias that and say as
because that's giving the column a name
so you're saying select the max salary
as
and we'll call that
max pay
okay and so now when we run that we see
max pay
that's cool that's the max function it's
just max and then your data
inside of that and then the next one i
want to talk about in this video is avg
which is average
so this is kind of cool if we pull in
the average salary as
we'll say
average salary or we'll say average pay
keep it consistent so now when we run
this
we should see it's right around 45 000
uh which just from the data we have
entered if you've seen it in the
previous videos or at the beginning of
this video
that should make sense but you can go
back and punch it in if you want
that's the average function it's avg it
doesn't mean
so so
that's that's the type of average you're
getting and then the next one is select
min
and if you do select min salary
as
min pay
then now when we run this
we get the lowest salary in the office
so that's kind of cool
um that's a just quick brief
introduction to the min max and average
functions
um as well as aliasing a column for
column name in presentation
you can use these in all kinds of more
advanced queries just understand if you
need to get a minimum from a data set
it's m i n parentheses and then what you
need the minimum inside of that if it's
max m a x open parenthesis put your data
inside that averages avg
that's really the basics of it and um
this is kind of a nice brief standalone
video so i think i'm going to leave it
at that for today but if you have any
questions about any of that or how to
use it in slightly more advanced
applications feel free to shoot me a
comment under the video and i'll try to
get back to you as soon as possible
and if you found any of that useful feel
free to drop a like or subscribe to the
channel it really helps me out a lot and
as always good luck with your projects
and thanks for watching thanks bye