SQL (8) AVG

Source: Internet
Author: User

SQL avg Syntax
SELECT AVG (column_name) from table_name
New table:
StudentS

s_id Grade Name Phone
1 98 Xiao Ming 123456
2 97 small Yellow 232456
3 95 Small Mile 987654
4 93 Little 654321
5 90 Pico 321065

Inquire:
SELECT AVG (Grade) as Gradeaverage from StudentS

Results:
Gradeaverage
94

We want to find the names of students with Grade values above the Grade average.

Inquire:
SELECT Name from StudentS
WHERE grade> (
SELECT AVG (Grade) from StudentS

Effect:

Name
1 xiaoming
2 small Yellow
3 Little miles.

2018-04-27 14:37:59

SQL (8) AVG

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.