MySQL

R4R® MySQL
(追記) (追記ここまで)
(追記) (追記ここまで)
Order By in MySQL

In this clause we are sorting the table according to the specified order given. Default sorting order is ascending order in sorting of numeric values , where as in letters it follow alphabetical order.

Syntax

SELECT *
FROM tablename
ORDER BY value1, value2;

here some examples is given below

SELECT *				//show all values
FROM studadr				//studadr is a tablename
ORDER BY aid ;				//sorting numeric value default 
(追記) (追記ここまで)

Example

SELECT *				//show all values
FROM studadr				//studadr is a tablename
ORDER BY aid desc ;			//sorting numeric value in descending order

Note Use DESC also used to reverse alphabetical to get the output in reverse order

Example

SELECT *					//show all values
FROM studadr					//studadr is a tablename
ORDER BY locatn, state ;			//ordering order is given

Note Use locatn and state both to get the output in which order preferences is given to get the output

Example

SELECT *					//show all values
FROM studadr					//studadr is a tablename
WHERE aid > 108					//Condition can be use
ORDER BY aid;					//ordering order is given

Example

SELECT *					//show all values
FROM studadr					//studadr is a tablename
WHERE aid > 108					//Condition can be use
ORDER BY locatn,state ;				//ordering order is given
(追記) (追記ここまで)
Copyright ©2021-22 r4r.co.in, all rights reserved. Theguestspost.com
Sitemap
Career
Post comment
About us
Subscription
Unsubscription

AltStyle によって変換されたページ (->オリジナル) /