SQL database query A table create a new sort field and store sorted values based on the sort of a column

Source: Internet
Author: User

Now there is a table as follows
Id Name Age classify score
1 1181 Class 12
2 2,172 class 19
3 3,193 Class 30

I'm going to rank them according to their scores. Create a new column store sort values
The->sql statement is as follows
Select Row_number () over (order by score ASC) as Number,id,name,age,classify,score
From U_college order by score;
The resulting effect is as follows
Numberid Name Age classify score
13 3,193 Class 30
22 2,172 Class 19
31 1181 Class 12
END;

SQL database query A table create a new sort field and store sorted values based on the sort of a column

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.