Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
0 Hi everyone 1
In this video 2
We'll learn about case expression 3
Case expression is a conditional expression 4
What is mean this if you want to specify several conditions on your data 5
While 6
Retrieving it or updating it 7
You can do it using the case expression 8
It is similar to mentioning the if else statements 9
While coding, so if you have done C , C++ or java 10
What you achieve by using if and else statements similar thing you can do using the case statement 11
The syntax of case statement is you write case 12
Then you mention when 13
Specify the first condition if it is true then 14
The result 15
You can again mention the second when, where you specify the second condition and if that is true 16
It will give the result 17
3rd, 4th and so on 18
And in the end you can specify else so if none of the condition specified above are true 19
The else will run 20
And whatever result you mentioned within this else clause 21
That will be executed 22
And to end the 23
Case expression we write end 24
There is another way to use case, you will write case and then mention an expression 25
This expression can be a column name 26
For each value in the column 27
This condition will be checked and wherever this condition is true 28
You will get the 29
Result corresponding to that condition 30
Let us look at 31
An example to understand it further 32
One of the major use cases of 33
Case statement is 34
When you want to assign categories to your data 35
So for example, in my customer data 36
If I want to categorise my 37
Customer data into 3 parts 38
Customers age Less than 30 will be categorised as young 39
Customers aged 30 to 60 will be called middle aged and customers 40
Beyond 60 years will be 41
Categorised as senior citizens 42
If I want to do this 43
I'll use case 44
I'll write select star so this will give me all the columns of the customer table 45
Comma 46
Case, so this will become a new column in after the entire table, so this column 47
Will be named case 48
And within this column, I want data 49
Such that 50
Customers who have age less 30 this column should contain young 51
Customers with age more than 60 this column should contain senior citizen 52
For all other customers 53
This column should contain middle aged 54
To finish this case statement 55
I'll write end 56
I can assign this whole column a name by using as age category 57
I do not write this 58
This column will be named as case 59
Now 60
Since I am using this alias this column will be named as age category 61
From 62
Customer table 63
Let us go and write this query in pg admin 64
We will select star 65
Comma case 66
When 67
Age is less than 30 68
Then output should be young 69
When age 70
Is more than 60 71
Then 72
Senior citizen 73
Else 74
Middle aged 75
End as 76
Age category 77
From 78
Customer 79
Let us run this 80
So if you scroll to the right 81
This new column will be 82
In the end 83
It is named as age category 84
And you can see 85
For customer with age 67, it has value senior citizen 86
For customer with age 33 it has 87
Value Middle aged 88
For customer with Value 20 89
It is young 90
This is how we use this conditional expression of case 91
That's all for this video, thanks
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.