sql注入语句示例大全
Order By is a SQL command that lets you sort the resulting output from a SQL query.
Order By是一个SQL命令,可让您对SQL查询的结果输出进行排序。
订购依据(ASC,DESC) (Order By (ASC, DESC))
ORDER BY gives us a way to SORT the result set by one or more of the items in the SELECT section. Here is an SQL sorting the students by FullName in descending order. The default sort order is ascending (ASC) but to sort in the opposite order (descending) you use DESC.
ORDER BY提供了一种对SELECT部分中一个或多个项目的结果集进行排序的方法。 这是一个按FullName降序对学生进行排序SQL。 默认的排序顺序为升序(ASC),但要使用相反的顺序(降序),请使用DESC。
Here's the query
这是查询
SELECT studentID, FullName, sat_score
FROM student
ORDER BY FullName DESC;
And here's the resulting data, presented in a nice descending table.
这是结果数据,以漂亮的降序表显示。
+-----------+------------------------+-----------+
| studentID | FullName | sat_score |
+-----------+------------------------+-----------+
| 2 | Teri Gutierrez | 800 |
| 3 | Spencer Pautier | 1000 |
| 6 | Sophie Freeman | 1200 |
| 9 | Raymond F. Boyce | 2400 |
| 1 | Monique Davis | 400 |
| 4 | Louis Ramsey | 1200 |
| 7 | Edgar Frank "Ted" Codd | 2400 |
| 8 | Donald D. Chamberlin | 2400 |
| 5 | Alvin Greene | 1200 |
+-----------+------------------------+-----------+
9 rows in set (0.00 sec)
Here is the UN-ORDERED, current, full student list to compare to the above.
这是与上述内容比较的未排序,当前的完整学生列表。
SELECT studentID, FullName, sat_score, rcd_updated FROM student;
+-----------+------------------------+-----------+---------------------+
| studentID | FullName | sat_score | rcd_updated |
+-----------+------------------------+-----------+---------------------+
| 1 | Monique Davis | 400 | 2017-08-16 15:34:50 |
| 2 | Teri Gutierrez | 800 | 2017-08-16 15:34:50 |
| 3 | Spencer Pautier | 1000 | 2017-08-16 15:34:50 |
| 4 | Louis Ramsey | 1200 | 2017-08-16 15:34:50 |
| 5 | Alvin Greene | 1200 | 2017-08-16 15:34:50 |
| 6 | Sophie Freeman | 1200 | 2017-08-16 15:34:50 |
| 7 | Edgar Frank "Ted" Codd | 2400 | 2017-08-16 15:35:33 |
| 8 | Donald D. Chamberlin | 2400 | 2017-08-16 15:35:33 |
| 9 | Raymond F. Boyce | 2400 | 2017-08-16 15:35:33 |
+-----------+------------------------+-----------+---------------------+
9 rows in set (0.00 sec)
As with all of these SQL things there is MUCH MORE to them than what’s in this introductory guide.
与所有这些SQL事物一样,它们比本入门指南中的内容要多得多。
I hope this at least gives you enough to get started.
我希望这至少能给您足够的入门。
Please see the manual for your database manager and have fun trying different options yourself.
请参阅数据库管理员的手册,并尝试自己尝试其他选项,这很有趣。
翻译自: https://www.freecodecamp.org/news/sql-order-by-statement-example-sytax/
sql注入语句示例大全