Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
What is grouping? | Grouping
SQL Basics
course content

Contenido del Curso

SQL Basics

SQL Basics

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

What is grouping?

Grouping - is arranging observations into sub-groups based on unique values in some column. For example, we can group our audi_cars table by transmission column (contains 3 unique values). There will be observations within each subgroup. So, what's the point of grouping?

In SQL grouping is often used in pair with some aggregate function within SELECT. For example, we can calculate the average price for each transmission type.

123
SELECT AVG(price), transmission FROM audi_cars GROUP BY transmission
copy

This will return all the transmissions types with average prices within each group.

Tarea

From the audi_cars table calculate the average price of each model. Round price to two decimals.

Tarea

From the audi_cars table calculate the average price of each model. Round price to two decimals.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 5. Capítulo 1
toggle bottom row

What is grouping?

Grouping - is arranging observations into sub-groups based on unique values in some column. For example, we can group our audi_cars table by transmission column (contains 3 unique values). There will be observations within each subgroup. So, what's the point of grouping?

In SQL grouping is often used in pair with some aggregate function within SELECT. For example, we can calculate the average price for each transmission type.

123
SELECT AVG(price), transmission FROM audi_cars GROUP BY transmission
copy

This will return all the transmissions types with average prices within each group.

Tarea

From the audi_cars table calculate the average price of each model. Round price to two decimals.

Tarea

From the audi_cars table calculate the average price of each model. Round price to two decimals.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 5. Capítulo 1
toggle bottom row

What is grouping?

Grouping - is arranging observations into sub-groups based on unique values in some column. For example, we can group our audi_cars table by transmission column (contains 3 unique values). There will be observations within each subgroup. So, what's the point of grouping?

In SQL grouping is often used in pair with some aggregate function within SELECT. For example, we can calculate the average price for each transmission type.

123
SELECT AVG(price), transmission FROM audi_cars GROUP BY transmission
copy

This will return all the transmissions types with average prices within each group.

Tarea

From the audi_cars table calculate the average price of each model. Round price to two decimals.

Tarea

From the audi_cars table calculate the average price of each model. Round price to two decimals.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Grouping - is arranging observations into sub-groups based on unique values in some column. For example, we can group our audi_cars table by transmission column (contains 3 unique values). There will be observations within each subgroup. So, what's the point of grouping?

In SQL grouping is often used in pair with some aggregate function within SELECT. For example, we can calculate the average price for each transmission type.

123
SELECT AVG(price), transmission FROM audi_cars GROUP BY transmission
copy

This will return all the transmissions types with average prices within each group.

Tarea

From the audi_cars table calculate the average price of each model. Round price to two decimals.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 5. Capítulo 1
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt