Functions and instances in SQL

Source: Internet
Author: User

AVG (average) count (count) max (max) min (minimum) SUM (summation) The syntax for applying a function is: selecte "function name" ("Column name") from "table name

1.AVG:Select AVG (Grade) from Table1, return result: Average of Grade column in Table1

2.COUNT:Select COUNT (Distinct Name) from Table1 where grade>60, return result: Table1 grade> 60 and the name does not repeat (distinct) the number of

3.group by: Group, instance: select Name Count (name) from Table1 where count (name) >3 GROUP by Name, return result: Name repeats more than 3 times name to and quantity

4.having: Syntax: Select column name from table name where condition having function,

Example: select name from Table1 GROUP by name has Count (name) >3, return result: Name repeats more than 3 times name

5.join: Table link, example: Select T1. S_name Name,sum (T2. Grade) Z_grade from Student t1,grades T2 where T1. Namw=t2. Name GROUP by T2. Name

Functions and instances in SQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.