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注入語句示例大全