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

bookMultiple 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
test

Swipe to show code editor

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

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

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

bookMultiple 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
test

Swipe to show code editor

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

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

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

bookMultiple 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
test

Swipe to show code editor

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

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

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
test

Swipe to show code editor

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

Switch to desktopCambia 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
Switch to desktopCambia 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