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

Зміст курсу

SQL Basics

SQL Basics

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

bookFiltering group size

Sometimes in real life, you can meet the situation where you have significant differences between two characteristics. For example, the average rate for one item is 5, and for another is 4.6. Without any further analysis looks like that the first item is better, but what if the first item received 2 rates and the second more than a thousand? We need to be ready to this effect.

For example, let's calculate the average price for each model having at least 10 cars in each group.

1234
SELECT model, AVG(price) FROM audi_cars GROUP BY model HAVING COUNT(*) > 10
copy

To calculate the number of observations in each group you can use the known COUNT(*) statement.

Завдання

From audi_cars calculate the average price for each engine size (enginesize column). Take into account only groups containing at least 7 observations and sort the resulting table by average price in ascending order.

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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

bookFiltering group size

Sometimes in real life, you can meet the situation where you have significant differences between two characteristics. For example, the average rate for one item is 5, and for another is 4.6. Without any further analysis looks like that the first item is better, but what if the first item received 2 rates and the second more than a thousand? We need to be ready to this effect.

For example, let's calculate the average price for each model having at least 10 cars in each group.

1234
SELECT model, AVG(price) FROM audi_cars GROUP BY model HAVING COUNT(*) > 10
copy

To calculate the number of observations in each group you can use the known COUNT(*) statement.

Завдання

From audi_cars calculate the average price for each engine size (enginesize column). Take into account only groups containing at least 7 observations and sort the resulting table by average price in ascending order.

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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

bookFiltering group size

Sometimes in real life, you can meet the situation where you have significant differences between two characteristics. For example, the average rate for one item is 5, and for another is 4.6. Without any further analysis looks like that the first item is better, but what if the first item received 2 rates and the second more than a thousand? We need to be ready to this effect.

For example, let's calculate the average price for each model having at least 10 cars in each group.

1234
SELECT model, AVG(price) FROM audi_cars GROUP BY model HAVING COUNT(*) > 10
copy

To calculate the number of observations in each group you can use the known COUNT(*) statement.

Завдання

From audi_cars calculate the average price for each engine size (enginesize column). Take into account only groups containing at least 7 observations and sort the resulting table by average price in ascending order.

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Sometimes in real life, you can meet the situation where you have significant differences between two characteristics. For example, the average rate for one item is 5, and for another is 4.6. Without any further analysis looks like that the first item is better, but what if the first item received 2 rates and the second more than a thousand? We need to be ready to this effect.

For example, let's calculate the average price for each model having at least 10 cars in each group.

1234
SELECT model, AVG(price) FROM audi_cars GROUP BY model HAVING COUNT(*) > 10
copy

To calculate the number of observations in each group you can use the known COUNT(*) statement.

Завдання

From audi_cars calculate the average price for each engine size (enginesize column). Take into account only groups containing at least 7 observations and sort the resulting table by average price in ascending order.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 5. Розділ 7
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
some-alt