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

Зміст курсу

SQL Basics

SQL Basics

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

HAVING 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.

Завдання

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

Завдання

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

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 5. Розділ 5
toggle bottom row

HAVING 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.

Завдання

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

Завдання

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

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 5. Розділ 5
toggle bottom row

HAVING 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.

Завдання

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

Завдання

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

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

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.

Завдання

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

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 5. Розділ 5
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt