My name is Mason Ellwood, and I’m currently working on Flatiron School’s Online Full Stack Web Development Program. Each week, I’ll be writing about my experience, what I’m learning, and tips on learning to code.
In the last post I was covering basic SQL queries, so you can be able to pull and place data that is inside of your table. We will continue to work with the SQLite database that we built in the last post if you did not read the last post here is a link (). But we will start this post of where the last one ended.
SQL aggregate functions are SQL statements that retrieve minimum and maximum values from a column, sum values in a column, an average of column values, or count a number of records that meet a certain condition.
COUNT: will count the number of records that meet a certain condition
GROUP BY: groups your result by a given column. The GROUP BY is a great way to aggregate results into different segments.
SQL Aggregate Function
With aggregate functions we can sum and average column data, request min and max values, and more. SQL makes available to you the use of keywords that allow us to group aggregated data by various conditions. Aggregate functions perform a calculation on specific values, queried from a database table. Some of them are AVG, SUM, COUNT, MIN, MAX.
AVG(): The average function returns the average value of a column
SUM(): Returns the sum of all the values in a particular column
MIN() and MAX(): Return the min and max values from a specific column respectively
COUNT(): Returns the number of rows that meet a certain condition
In the next post we will get into table relations. But with this you can see how we can pull, and narrow down what information we need to gather. So far The Flatiron School has done a great job at explaining what SQL is and how it is useful. Let me know if you have any questions and I will do my best to respond as well as I can.
Leave a Reply