-
Notifications
You must be signed in to change notification settings - Fork 0
Aggregate Functions
JoshuaKennedy edited this page Oct 12, 2014
·
4 revisions
AVG | COUNT | FIRST | LAST | MAX | MIN | SUM |
---|
SQL aggregate functions return a single value, calculated from values in a column.
For the examples they will be using the INVENTORY table below.
NAME | QUANTITY | PRICE | ID |
---|---|---|---|
Box of Crackers | 150 | 1.25 | 5841976320 |
Bottled Water | 50 | 0.75 | 2704831956 |
Headphones | 75 | 10.00 | 3671580924 |
Cellular Smart Phone | 100 | 500.00 | 6103495827 |
Brand New Video Game | 500 | 60.00 | NULL |
Monster Energy Drink® | 25 | 2.00 | 8429071365 |
Code examples contained herein are created by Chad Jensen (@cbjjensen) and/or Josh Kennedy (@JoshuaKennedy) and are placed in the public domain.
THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE CODE.