All language subtitles for 2. ORDER BY

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 0 1 00:00:01,280 --> 00:00:03,584 Now, let us start with the order by command 1 2 00:00:04,096 --> 00:00:10,240 This command will help us sort our results, so till now we have been filtering our resultset, we have been applying 2 3 00:00:10,496 --> 00:00:11,008 filters 3 4 00:00:11,264 --> 00:00:15,104 To get particular data, which is specifying particular conditions 4 5 00:00:15,616 --> 00:00:21,760 Now the result that we have received, we want to sort it in a particular order, to sort the data we'll use 5 6 00:00:22,016 --> 00:00:22,784 Order by 6 7 00:00:23,040 --> 00:00:24,320 How to use order by 7 8 00:00:24,576 --> 00:00:26,880 Select the columns from the table name 8 9 00:00:27,392 --> 00:00:29,440 Put the condition if you want to 9 10 00:00:29,696 --> 00:00:32,512 So that is an optional part, then you write order by 10 11 00:00:32,768 --> 00:00:35,840 And then you tell the column name with which you want to order it 11 12 00:00:36,096 --> 00:00:39,424 Then you you specify in ascending order or in the descending order 12 13 00:00:39,680 --> 00:00:43,264 It is possible that you specify more than one column 13 14 00:00:43,520 --> 00:00:44,544 And you can specify 14 15 00:00:45,056 --> 00:00:48,896 And you can specify whether you want to do ascending descending 15 16 00:00:49,152 --> 00:00:52,992 Ordering with column 1 and ascending descending order with column 2 16 17 00:00:53,504 --> 00:00:56,320 That is also possible, we will see that in the examples 17 18 00:00:59,136 --> 00:01:00,928 So in the first example 18 19 00:01:01,184 --> 00:01:02,464 What we are trying to get is 19 20 00:01:02,720 --> 00:01:05,024 If you want to find out all the customers 20 21 00:01:06,048 --> 00:01:06,560 Who 21 22 00:01:06,816 --> 00:01:08,608 Reside in the state of California 22 23 00:01:09,376 --> 00:01:09,888 And 23 24 00:01:10,400 --> 00:01:13,472 We want that result to be ordered by the customer name 24 25 00:01:13,984 --> 00:01:16,800 If I just write order by customer name 25 26 00:01:17,056 --> 00:01:20,384 It will automatically order it in the ascending order 26 27 00:01:21,664 --> 00:01:25,760 If I write this ASC keyword also 27 28 00:01:26,016 --> 00:01:26,784 It will 28 29 00:01:27,040 --> 00:01:30,112 Do the same thing, so both of these commands are same 29 30 00:01:30,368 --> 00:01:33,696 Let's go and write this command and see what is the result that we get 30 31 00:01:36,768 --> 00:01:40,352 We want to find out everything select star 31 32 00:01:40,608 --> 00:01:44,448 From customer 32 33 00:01:44,960 --> 00:01:48,032 Where the state 33 34 00:01:49,312 --> 00:01:51,104 Is California 34 35 00:01:55,712 --> 00:02:00,064 And we want to order it by 35 36 00:02:00,576 --> 00:02:03,392 The customer name 36 37 00:02:07,488 --> 00:02:08,768 Let us run this command 37 38 00:02:11,584 --> 00:02:12,608 So you can see 38 39 00:02:15,680 --> 00:02:16,960 You Scroll it to the right 39 40 00:02:17,472 --> 00:02:21,824 All these customers have the state California, this was specified in the where condition 40 41 00:02:22,336 --> 00:02:23,104 And 41 42 00:02:23,360 --> 00:02:24,896 The customer names 42 43 00:02:25,152 --> 00:02:28,480 Are arranged in the alphabetical order so first 43 44 00:02:28,992 --> 00:02:29,760 Is Allen 44 45 00:02:30,528 --> 00:02:31,552 Then comes 45 46 00:02:32,064 --> 00:02:36,416 Customer with name starting with B then comes customer with name starting with c 46 47 00:02:36,672 --> 00:02:37,696 And so on 47 48 00:02:38,208 --> 00:02:38,976 So they are 48 49 00:02:39,232 --> 00:02:40,512 Arranged alphabetically 49 50 00:02:40,768 --> 00:02:41,792 In Ascending order 50 51 00:02:42,560 --> 00:02:44,864 If you want to arrange them in descending order 51 52 00:02:45,376 --> 00:02:48,960 Just add the keyword for descending 52 53 00:03:02,272 --> 00:03:08,160 Order by 53 54 00:03:08,416 --> 00:03:09,952 Customer name 54 55 00:03:11,232 --> 00:03:16,864 Then you specify the keyword 55 56 00:03:17,632 --> 00:03:19,424 Descending DESC 56 57 00:03:22,496 --> 00:03:23,520 So you can see 57 58 00:03:24,032 --> 00:03:27,616 The Customer names are now in descending order, with starting with Z 58 59 00:03:27,872 --> 00:03:28,640 Then Y 59 60 00:03:29,152 --> 00:03:32,480 Then X and if you go down it will be ending with 60 61 00:03:32,736 --> 00:03:34,016 Customer name starting with A 61 62 00:03:35,296 --> 00:03:39,136 You can give two column names at the same time while ordering 62 63 00:03:39,392 --> 00:03:40,416 If you want to 63 64 00:03:40,672 --> 00:03:41,184 First 64 65 00:03:41,952 --> 00:03:43,232 Order the data 65 66 00:03:43,488 --> 00:03:45,792 With city in ascending order 66 67 00:03:46,304 --> 00:03:51,424 And then you want to arrange the data according to the customer name in descending order 67 68 00:03:52,192 --> 00:03:53,216 That can also to be done 68 69 00:03:53,728 --> 00:03:54,240 So 69 70 00:03:54,496 --> 00:03:56,288 Let us start writing that query 70 71 00:03:56,800 --> 00:04:00,896 We will order the 71 72 00:04:01,152 --> 00:04:06,528 Data in ascending order with city name and descending with 72 73 00:04:07,296 --> 00:04:08,064 Customer name 73 74 00:04:11,648 --> 00:04:13,184 Order by 74 75 00:04:14,208 --> 00:04:16,000 City 75 76 00:04:16,512 --> 00:04:19,071 ASC 76 77 00:04:22,399 --> 00:04:23,423 By 77 78 00:04:24,959 --> 00:04:27,263 Customer name descending 78 79 00:04:32,127 --> 00:04:34,175 Run this query 79 80 00:04:37,503 --> 00:04:39,295 First look at the City part 80 81 00:04:40,831 --> 00:04:41,343 This 81 82 00:04:41,855 --> 00:04:44,415 You can see cities are arranged in ascending order 82 83 00:04:44,927 --> 00:04:47,231 Starting with A going down 83 84 00:04:47,487 --> 00:04:49,791 Then comes B C and so on 84 85 00:04:51,071 --> 00:04:53,119 The first two have the same city 85 86 00:04:53,631 --> 00:04:55,167 So their customer name 86 87 00:04:55,423 --> 00:05:01,055 Is arranged in descending order, you first get a customer name is starting with M then you get 87 88 00:05:01,311 --> 00:05:02,591 Starting with e 88 89 00:05:03,103 --> 00:05:04,639 Same is with the next 89 90 00:05:04,895 --> 00:05:05,407 City 90 91 00:05:06,175 --> 00:05:10,271 That's how first it is sorting the data using the city column 91 92 00:05:10,527 --> 00:05:11,551 In ascending order 92 93 00:05:11,807 --> 00:05:13,599 Then it is arranging the data 93 94 00:05:13,855 --> 00:05:15,903 In descending order with the customer name 94 95 00:05:17,183 --> 00:05:19,231 While ordering the data 95 96 00:05:19,743 --> 00:05:24,863 Instead of mentioning the column name you can also specify the column number 96 97 00:05:25,375 --> 00:05:26,911 You can write something like this 97 98 00:05:27,167 --> 00:05:28,191 Order by 98 99 00:05:28,447 --> 00:05:30,239 This is the column number 2 99 100 00:05:31,263 --> 00:05:35,103 In our data column number 2 is customer name, So if you like this it will 100 101 00:05:35,359 --> 00:05:37,151 Order the data in descending order 101 102 00:05:37,407 --> 00:05:38,431 With customer name 102 103 00:05:39,455 --> 00:05:41,503 And you can also use 103 104 00:05:42,015 --> 00:05:46,623 Columns which are non textual so if you use a column which has 104 105 00:05:47,135 --> 00:05:49,183 Age which will be an integer 105 106 00:05:49,439 --> 00:05:53,535 It will order the integers in ascending or descending order so 106 107 00:05:53,791 --> 00:05:55,583 Let's do both of this things 107 108 00:05:56,607 --> 00:06:02,751 So let's order this data using the column number 108 109 00:06:03,007 --> 00:06:04,031 Which is 2 109 110 00:06:05,567 --> 00:06:08,639 Order by 2 110 111 00:06:08,895 --> 00:06:09,663 Ascending 111 112 00:06:16,575 --> 00:06:17,343 You can see 112 113 00:06:17,855 --> 00:06:19,135 This is ordered in the 113 114 00:06:19,391 --> 00:06:21,695 The customer name, which is the column number 2 114 115 00:06:22,207 --> 00:06:23,231 Is used to 115 116 00:06:23,487 --> 00:06:25,023 Sort the data in ascending order 116 117 00:06:26,559 --> 00:06:27,327 Now let us sort 117 118 00:06:27,839 --> 00:06:28,607 Sort 118 119 00:06:28,863 --> 00:06:29,887 The customers 119 120 00:06:30,399 --> 00:06:31,679 Basis their age 120 121 00:06:31,935 --> 00:06:38,079 We have the customers who have maximum age on top and minimum at the bottom 121 122 00:06:38,335 --> 00:06:41,151 So We'll be arranging them in the descending order 122 123 00:06:41,407 --> 00:06:44,479 Order by age 123 124 00:06:44,735 --> 00:06:49,343 Descending DESC 124 125 00:06:49,855 --> 00:06:50,623 Run it 125 126 00:06:51,903 --> 00:06:52,671 You can see 126 127 00:06:53,183 --> 00:06:54,719 There are several customers 127 128 00:06:55,231 --> 00:06:55,999 With age 128 129 00:06:57,023 --> 00:07:00,351 70 then comes 69 and so on 129 130 00:07:00,863 --> 00:07:01,631 So 130 131 00:07:03,167 --> 00:07:08,287 Both strings and integers can be used to sort the data 131 132 00:07:09,311 --> 00:07:14,687 If it is a string it will be sorted in a to z Or z to a manner basis the 132 133 00:07:14,943 --> 00:07:17,503 Keyword you have used ascending or descending 133 134 00:07:18,271 --> 00:07:19,807 If it is a integer 134 135 00:07:20,063 --> 00:07:23,647 It Will be arranged in smallest to largest or largest to smallest 135 136 00:07:23,903 --> 00:07:26,463 Basis the ascending descending that you have specified 136 137 00:07:26,975 --> 00:07:30,303 If you have not specified anything it will be ascending by default 137 138 00:07:30,815 --> 00:07:33,119 That's how we Sort the data 138 139 00:07:33,631 --> 00:07:34,655 In the next video 139 140 00:07:34,911 --> 00:07:36,703 We'll learn how to limit the 140 141 00:07:36,959 --> 00:07:40,799 Number of rows that we are getting back when we run a query 10606

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.