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
In the last video, we learned how to apply one condition while retrieving data.
Let us now look at how to retrieve data, which is satisfying multiple conditions.
Multiple conditions can be applied using the and and or operators.
And operators used when we want that, all of the conditions are satisfied.
Whereas our operator will be used when we want to retrieve the data with any one of the conditions.
Satisfied.
Let us look at this syntax.
We select columns from table name where this will be the condition one.
After this, if you want to have an and operator, we will write.
And if you want all operator, we will write all and then we will specify the second condition.
We can continue doing so.
We can have a number of conditions.
Let us look at an example.
If you want to get the customers.
Who's age is between 20 and 30 years.
We can do this by using the and operator.
So these customers will be satisfying the condition that their age is more than 20 years and the age
is less than 30 years.
So we will select first name, last name and age of the customer from customer table, where age is
greater than 20 and age is less than 30.
Let us go and write this in PG admin.
Select first name.
Last name.
From.
Let's add age also.
Customer table.
Where?
It is greater than 20 and it is less than.
30.
And that's when this query.
You can see five records are retrieved.
And age of all these five customers is between 20 and 30.
Now, if we want all the other customers, that is customer whose age is less than 20 or more than 30,
we will be using the auto operator.
Let us write that.
Select.
First name.
Last name.
Age.
The age is less than 20.
Or it is greater than equal to 30.
That's when this.
You can see.
So all the customers who have less than 20 or is less than 30 have been retrieved.
These are the other five rows of the table.
Apart from and and all.
There is one more logical operator called not.
Not operator is used to negate a condition.
So last time.
When we found out that there is one customer with age 25.
If you want to find out all the other customers you can just use not.
So let us write this example where we are finding out all the customers with is not is equal to 25.
From customer table.
Where?
We are not.
Age is equal to 25.
So this will give us all the customers.
We did not equal to five.
So last time, if you remember, we got three records.
Our table has total ten records.
These are the other seven records.
Now you can use this knot operator along with and another operator.
So, for example, if you want to specify that you want to get all the customers with age not equal
to 25 and the customer's first name should not be G.
So both of these conditions can be applied simultaneously.
We will select start.
From customer table.
We're.
Not age is equal to 25.
They're not.
Age is equal to 25.
And.
Not.
First name.
Is equal to.
J.
You run this.
See, the J records are also removed.
Now we have only four records.
And the result?
So these are the three logical operators which help us put multiple conditions in the same query.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.