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

Conteúdo do 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.

Tarefa

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

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 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.

Tarefa

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

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 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.

Tarefa

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

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

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.

Tarefa

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

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 2. Capítulo 5
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
some-alt