Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
HAVING some conditions | Grouping
SQL Basics
course content

Conteúdo do Curso

SQL Basics

SQL Basics

1. Selecting
2. Filtering
3. Aggregating
4. Sorting
5. Grouping
6. Practicing

bookHAVING some conditions

What if we want to filter grouped observations based on some condition? For example, we want to extract only those models available with Hybrid fuel types.

You can do it by grouping firstly by model, and then by fuel type filtered by condition on fueltype.

1234
SELECT model FROM audi_cars GROUP BY model, fueltype HAVING fueltype = 'Hybrid'
copy

Please note, that you can use all the operators learned in the second section within HAVING statement.

Tarefa

From the audi_cars table extract all the models available with Automatic transmission.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 5. Capítulo 5
toggle bottom row

bookHAVING some conditions

What if we want to filter grouped observations based on some condition? For example, we want to extract only those models available with Hybrid fuel types.

You can do it by grouping firstly by model, and then by fuel type filtered by condition on fueltype.

1234
SELECT model FROM audi_cars GROUP BY model, fueltype HAVING fueltype = 'Hybrid'
copy

Please note, that you can use all the operators learned in the second section within HAVING statement.

Tarefa

From the audi_cars table extract all the models available with Automatic transmission.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 5. Capítulo 5
toggle bottom row

bookHAVING some conditions

What if we want to filter grouped observations based on some condition? For example, we want to extract only those models available with Hybrid fuel types.

You can do it by grouping firstly by model, and then by fuel type filtered by condition on fueltype.

1234
SELECT model FROM audi_cars GROUP BY model, fueltype HAVING fueltype = 'Hybrid'
copy

Please note, that you can use all the operators learned in the second section within HAVING statement.

Tarefa

From the audi_cars table extract all the models available with Automatic transmission.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

What if we want to filter grouped observations based on some condition? For example, we want to extract only those models available with Hybrid fuel types.

You can do it by grouping firstly by model, and then by fuel type filtered by condition on fueltype.

1234
SELECT model FROM audi_cars GROUP BY model, fueltype HAVING fueltype = 'Hybrid'
copy

Please note, that you can use all the operators learned in the second section within HAVING statement.

Tarefa

From the audi_cars table extract all the models available with Automatic transmission.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 5. Capítulo 5
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
some-alt