SQL statement Learning (1)

Source: Internet
Author: User

First, create a table

CREATE TABLE' student ' (' ID ')int( -) not NULLauto_increment, ' name 'varchar( -)DEFAULT NULLCOMMENT'name', ' subject 'varchar( -)DEFAULT NULLCOMMENT'Courses', ' score 'varchar(Ten)DEFAULT NULLCOMMENT'score', ' Stuid 'varchar( -)DEFAULT NULLCOMMENT'School Number',  PRIMARY KEY(' id ')) ENGINE=InnoDB auto_increment=Ten DEFAULTCHARSET=UTF8;

Second, insert data

Third, SQL statement operations

1. Calculate the total number of each person and rank (requires display field: Name, overall scores)

2. Calculate each person's total and rank (required field: number, name, overall)

3. Calculate the highest score for each individual (required field: School number, name, course, highest score)

4. Calculate each person's average score (requires display field: study number, name, average score)

5. List the students who have the best grades in each course (Required fields: Student number, name, subject, score)

6. List of the two students who have the best results in each course (Required fields: Student number, name, subject, score)

SQL statement Learning (1)

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.