All language subtitles for 2. HAVING

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

0 Now we know, how to use group by and how to use aggregate functions within group by 1

Now we want to put a filter or specify a condition 2

On this aggregate functions 3

How can we do that 4

This is done using the having clause 5

Having clause will restrict the groups of returned rows to only those whose condition is true 6

The syntax for having clause is 7

Select the column names or the aggregate function 8

From table 9

You can specify where conditions if you want to 10

Then you specify the group by 11

And Name the column with which you want to group 12

Then we specify the having condition 13

Let us see this example 14

IN this example 15

I want to find the number of customers 16

In each region 17

But I want to also put condition that I want only those regions 18

Which have more than 200 customers 19

To do this 20

I'll write select region 21

And count of customers 22

From the customer table 23

Group by region 24

And having count of customer ID greater than 200 25

This is the aggregate function 26

So let us go and write this in the PG admin 27

So, I'll select 28

The region and the count of customer ID 29

From 30

As customer count from 31

The table customer group by 32

Region 33

Having 34

Count of customer ID 35

Greater than 36

Greater than 200 37

This query will return me these two regions which have customers 38

more than 200 39

Now if you remember 40

We used to specify conditions in the where clause 41

Now we are specifying this condition in the having clause 42

What is the difference 43

The having Clause is used to specify conditions for the aggregate function 44

Whereas 45

Where was used to specific conditions on the 46

Non-aggregate columns 47

So for example in this query only 48

If, I want to put a condition that I want only count of customers whose name starts with A 49

Then I will write where 50

Customer name 51

Like A percent 52

So let us find out 53

Such customers, count of customer ID 54

As customer count 55

From customer 56

Where 57

Customer name 58

Like 59

A percent 60

Group by region 61

by region 62

Lets run this 63

this is the count of customers whose name 64

Starts with A in 65

These four different regions 66

I can put the having condition also 67

Having count of customer ID 68

Greater than 15, so if you look at this table below 2 of the field 69

Will go 70

And two will remain which are greater than 15 71

So, Two major differences, one where is written before group by and having his return after group by 72

Second 73

Having is used to put condition on aggregate functions whereas condition on non aggregate columns are put 74

Using the where clause

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