Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Multiple filtering on one column | Filtering
SQL Basics
course content

Contenido del Curso

SQL Basics

SQL Basics

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

Multiple filtering on one column

What if we are interested only in two models: let it be A4 and A5?

Of course, we could write WHERE model = 'A4' OR model = 'A5'. But is there a point in writing two conditions for the same column? This problem is also solved in SQL by using IN statement. To check if a value from a column is one of acceptable use WHERE column IN ('value1', 'value2', ...) syntax. For example,

123
SELECT * FROM audi_cars WHERE model IN ('A4', 'A5')
copy

WHERE column IN ('value1', 'value2') is equvivalent to WHERE column = 'value1' OR column = 'value2'. It also works for numeric values.

Tarea

From audi_cars extract cars with engine size (enginesize column) 1.5 and 2.9 using IN statement.

Tarea

From audi_cars extract cars with engine size (enginesize column) 1.5 and 2.9 using IN statement.

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 2. Capítulo 5
toggle bottom row

Multiple filtering on one column

What if we are interested only in two models: let it be A4 and A5?

Of course, we could write WHERE model = 'A4' OR model = 'A5'. But is there a point in writing two conditions for the same column? This problem is also solved in SQL by using IN statement. To check if a value from a column is one of acceptable use WHERE column IN ('value1', 'value2', ...) syntax. For example,

123
SELECT * FROM audi_cars WHERE model IN ('A4', 'A5')
copy

WHERE column IN ('value1', 'value2') is equvivalent to WHERE column = 'value1' OR column = 'value2'. It also works for numeric values.

Tarea

From audi_cars extract cars with engine size (enginesize column) 1.5 and 2.9 using IN statement.

Tarea

From audi_cars extract cars with engine size (enginesize column) 1.5 and 2.9 using IN statement.

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 2. Capítulo 5
toggle bottom row

Multiple filtering on one column

What if we are interested only in two models: let it be A4 and A5?

Of course, we could write WHERE model = 'A4' OR model = 'A5'. But is there a point in writing two conditions for the same column? This problem is also solved in SQL by using IN statement. To check if a value from a column is one of acceptable use WHERE column IN ('value1', 'value2', ...) syntax. For example,

123
SELECT * FROM audi_cars WHERE model IN ('A4', 'A5')
copy

WHERE column IN ('value1', 'value2') is equvivalent to WHERE column = 'value1' OR column = 'value2'. It also works for numeric values.

Tarea

From audi_cars extract cars with engine size (enginesize column) 1.5 and 2.9 using IN statement.

Tarea

From audi_cars extract cars with engine size (enginesize column) 1.5 and 2.9 using IN statement.

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

¿Todo estuvo claro?

What if we are interested only in two models: let it be A4 and A5?

Of course, we could write WHERE model = 'A4' OR model = 'A5'. But is there a point in writing two conditions for the same column? This problem is also solved in SQL by using IN statement. To check if a value from a column is one of acceptable use WHERE column IN ('value1', 'value2', ...) syntax. For example,

123
SELECT * FROM audi_cars WHERE model IN ('A4', 'A5')
copy

WHERE column IN ('value1', 'value2') is equvivalent to WHERE column = 'value1' OR column = 'value2'. It also works for numeric values.

Tarea

From audi_cars extract cars with engine size (enginesize column) 1.5 and 2.9 using IN statement.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 2. Capítulo 5
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