Order by keyword in SQL

4 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€46.59
List Price:  €65.24
You save:  €18.64
£39.95
List Price:  £55.93
You save:  £15.98
CA$68.27
List Price:  CA$95.58
You save:  CA$27.31
A$76.51
List Price:  A$107.13
You save:  A$30.61
S$68.03
List Price:  S$95.25
You save:  S$27.21
HK$391.33
List Price:  HK$547.90
You save:  HK$156.56
CHF 45.60
List Price:  CHF 63.85
You save:  CHF 18.24
NOK kr550.06
List Price:  NOK kr770.13
You save:  NOK kr220.06
DKK kr347.49
List Price:  DKK kr486.51
You save:  DKK kr139.02
NZ$84.03
List Price:  NZ$117.65
You save:  NZ$33.61
د.إ183.60
List Price:  د.إ257.06
You save:  د.إ73.45
৳5,484.82
List Price:  ৳7,679.19
You save:  ৳2,194.37
₹4,167.13
List Price:  ₹5,834.32
You save:  ₹1,667.18
RM238.42
List Price:  RM333.81
You save:  RM95.39
₦65,297.93
List Price:  ₦91,422.33
You save:  ₦26,124.40
₨13,918.71
List Price:  ₨19,487.31
You save:  ₨5,568.59
฿1,846.97
List Price:  ฿2,585.90
You save:  ฿738.93
₺1,626.69
List Price:  ₺2,277.50
You save:  ₺650.80
B$257.91
List Price:  B$361.10
You save:  B$103.18
R942.93
List Price:  R1,320.17
You save:  R377.24
Лв91.05
List Price:  Лв127.48
You save:  Лв36.42
₩68,777.09
List Price:  ₩96,293.43
You save:  ₩27,516.34
₪190.37
List Price:  ₪266.53
You save:  ₪76.16
₱2,884.27
List Price:  ₱4,038.21
You save:  ₱1,153.93
¥7,839.25
List Price:  ¥10,975.59
You save:  ¥3,136.33
MX$862.02
List Price:  MX$1,206.90
You save:  MX$344.87
QR182.32
List Price:  QR255.26
You save:  QR72.94
P689.82
List Price:  P965.80
You save:  P275.98
KSh6,748.65
List Price:  KSh9,448.65
You save:  KSh2,700
E£2,394.60
List Price:  E£3,352.63
You save:  E£958.03
ብር2,846.33
List Price:  ብር3,985.10
You save:  ብር1,138.76
Kz41,775.97
List Price:  Kz58,489.70
You save:  Kz16,713.73
CLP$47,415.51
List Price:  CLP$66,385.51
You save:  CLP$18,970
CN¥362.26
List Price:  CN¥507.19
You save:  CN¥144.93
RD$2,936.27
List Price:  RD$4,111.01
You save:  RD$1,174.74
DA6,712.91
List Price:  DA9,398.61
You save:  DA2,685.70
FJ$112.97
List Price:  FJ$158.17
You save:  FJ$45.19
Q388.83
List Price:  Q544.39
You save:  Q155.56
GY$10,456.12
List Price:  GY$14,639.41
You save:  GY$4,183.28
ISK kr6,993.60
List Price:  ISK kr9,791.60
You save:  ISK kr2,798
DH505.76
List Price:  DH708.11
You save:  DH202.34
L888.32
List Price:  L1,243.72
You save:  L355.39
ден2,869.11
List Price:  ден4,016.98
You save:  ден1,147.87
MOP$402.79
List Price:  MOP$563.94
You save:  MOP$161.15
N$957.24
List Price:  N$1,340.22
You save:  N$382.97
C$1,839.29
List Price:  C$2,575.16
You save:  C$735.86
रु6,654.43
List Price:  रु9,316.74
You save:  रु2,662.30
S/186.47
List Price:  S/261.07
You save:  S/74.60
K192.50
List Price:  K269.52
You save:  K77.01
SAR187.49
List Price:  SAR262.50
You save:  SAR75.01
ZK1,315.66
List Price:  ZK1,842.03
You save:  ZK526.37
L231.86
List Price:  L324.63
You save:  L92.76
Kč1,171.86
List Price:  Kč1,640.70
You save:  Kč468.84
Ft18,288.87
List Price:  Ft25,605.88
You save:  Ft7,317.01
SEK kr544.90
List Price:  SEK kr762.91
You save:  SEK kr218
ARS$43,678.56
List Price:  ARS$61,153.48
You save:  ARS$17,474.92
Bs346.09
List Price:  Bs484.56
You save:  Bs138.46
COP$197,009.16
List Price:  COP$275,828.59
You save:  COP$78,819.43
₡25,122.12
List Price:  ₡35,172.98
You save:  ₡10,050.86
L1,233.97
List Price:  L1,727.65
You save:  L493.68
₲371,261.88
List Price:  ₲519,796.34
You save:  ₲148,534.45
$U1,917.12
List Price:  $U2,684.12
You save:  $U767
zł201.38
List Price:  zł281.95
You save:  zł80.57
Already have an account? Log In

Transcript

So you're getting the results from the database, make sure this is a result set. And you're patching these reserves using this query, select query. Okay? It's very simple. Now as you know, it's showing you the reserves, ascending order, because by default database management system use ascending order to show you the result for suppose if you want to show the reserves, descending order, or suppose you want to show fourth or fourth record on the top, so how can you do that? First of all, I'm saying so databases, that means it's showing us the database as you know, we have created the university database.

So now I'm saying use you use University database Ctrl, enter. So As, as you can see, it's using the GST database. Now I'm saying select static. from students table, you know that we have created the students table in the database. So now I'm executing this query, we have two ways to execute this query using data good, because we are using the data good tool. So this is the interface of the data to right click Execute query.

This is the first method. The second method is Ctrl and press the Enter button. Now Ctrl Enter to getting good results. Now I'm saying please show me the result set and descending order. So how can we do that? I'm saying THE ORDER BY clause SO THIS IS THE ORDER BY clause or this is the key word and now I'm saying order by Id s id DSDSC.

Now I'm saying, show me all the columns from students table. And I'm saying that please show me the order by s ID about this one. As you know, the shaggy is a fourth record. And now the third record is water. And the second record is okay, now and executing the query, we have two methods, you know, basically the two units using data grid, right click, press this button, or hold the Ctrl key and hit the enter button. As you know, it's showing us the result in descending order, but using it, okay, now, if I'm saying it, if I'm saying ascending order is C control in the first row.

By default, we have the same order. If I'm saying show me the results by city, by city, ascending order Ctrl F now as you see, it's showing the by city ascending order. So I record I and if I'm saying show me the results by descending order the ESC control intervals you can see you're showing us the results by descending order for the know the L L NT coming first, now the I entry second and I second I that means slower and this is India. So now USING THE ORDER BY clause, you can sort the results ascending or descending order So, everybody

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.