Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
SQL Where | Database & Introduction to Syntax
SQL Tutorial for Beginners
course content

Contenido del Curso

SQL Tutorial for Beginners

SQL Tutorial for Beginners

1. Database & Introduction to Syntax
2. SQL Aggregate Functions
3. Filtering Statements

bookSQL Where

You’ll need to filter your selected data very often, so you need to use WHERE keyword. After WHERE you put some condition or combination of them. Usually it is some column's values limitations.

For example, you want to select records where singer is AC/DC:

12
SELECT * FROM songs WHERE singer = 'AC/DC'
copy

Another example of the query using the WHERE statement. It retrieves all records with a price column value greater than 100. The syntax is pretty easy to understand: WHERE price > 100.

12
SELECT * FROM songs WHERE price > 100
copy

Here you can see the main syntax.

  • Use = to find fields which values are equal to some naming.
  • Use != or <> to find non-equal fields.
  • Use >, <, >=, <= for comparing.
  • Use single quotes 'Quotes' for string values.
  • Use () brackets for prioritization.
123
/* all records where year column is greater or equal than 1970*/ SELECT * FROM songs WHERE year >= 1970
copy

For string values, you have to write them inside single quotes. Like 'ABBA', 'Toxic' etc. Check carefully string values in the condition statements: no extra spaces, correct capitalization (for example, Britney Spears is correct, not BRITNEY SPEARS or britney spears). Otherwise, you'll receive the Internal Server Error.

Tarea

Select all records with Britney Spears as a singer. Change your query to select only Britney Spears songs' titles (not full records, only column title).

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

bookSQL Where

You’ll need to filter your selected data very often, so you need to use WHERE keyword. After WHERE you put some condition or combination of them. Usually it is some column's values limitations.

For example, you want to select records where singer is AC/DC:

12
SELECT * FROM songs WHERE singer = 'AC/DC'
copy

Another example of the query using the WHERE statement. It retrieves all records with a price column value greater than 100. The syntax is pretty easy to understand: WHERE price > 100.

12
SELECT * FROM songs WHERE price > 100
copy

Here you can see the main syntax.

  • Use = to find fields which values are equal to some naming.
  • Use != or <> to find non-equal fields.
  • Use >, <, >=, <= for comparing.
  • Use single quotes 'Quotes' for string values.
  • Use () brackets for prioritization.
123
/* all records where year column is greater or equal than 1970*/ SELECT * FROM songs WHERE year >= 1970
copy

For string values, you have to write them inside single quotes. Like 'ABBA', 'Toxic' etc. Check carefully string values in the condition statements: no extra spaces, correct capitalization (for example, Britney Spears is correct, not BRITNEY SPEARS or britney spears). Otherwise, you'll receive the Internal Server Error.

Tarea

Select all records with Britney Spears as a singer. Change your query to select only Britney Spears songs' titles (not full records, only column title).

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

bookSQL Where

You’ll need to filter your selected data very often, so you need to use WHERE keyword. After WHERE you put some condition or combination of them. Usually it is some column's values limitations.

For example, you want to select records where singer is AC/DC:

12
SELECT * FROM songs WHERE singer = 'AC/DC'
copy

Another example of the query using the WHERE statement. It retrieves all records with a price column value greater than 100. The syntax is pretty easy to understand: WHERE price > 100.

12
SELECT * FROM songs WHERE price > 100
copy

Here you can see the main syntax.

  • Use = to find fields which values are equal to some naming.
  • Use != or <> to find non-equal fields.
  • Use >, <, >=, <= for comparing.
  • Use single quotes 'Quotes' for string values.
  • Use () brackets for prioritization.
123
/* all records where year column is greater or equal than 1970*/ SELECT * FROM songs WHERE year >= 1970
copy

For string values, you have to write them inside single quotes. Like 'ABBA', 'Toxic' etc. Check carefully string values in the condition statements: no extra spaces, correct capitalization (for example, Britney Spears is correct, not BRITNEY SPEARS or britney spears). Otherwise, you'll receive the Internal Server Error.

Tarea

Select all records with Britney Spears as a singer. Change your query to select only Britney Spears songs' titles (not full records, only column title).

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!

You’ll need to filter your selected data very often, so you need to use WHERE keyword. After WHERE you put some condition or combination of them. Usually it is some column's values limitations.

For example, you want to select records where singer is AC/DC:

12
SELECT * FROM songs WHERE singer = 'AC/DC'
copy

Another example of the query using the WHERE statement. It retrieves all records with a price column value greater than 100. The syntax is pretty easy to understand: WHERE price > 100.

12
SELECT * FROM songs WHERE price > 100
copy

Here you can see the main syntax.

  • Use = to find fields which values are equal to some naming.
  • Use != or <> to find non-equal fields.
  • Use >, <, >=, <= for comparing.
  • Use single quotes 'Quotes' for string values.
  • Use () brackets for prioritization.
123
/* all records where year column is greater or equal than 1970*/ SELECT * FROM songs WHERE year >= 1970
copy

For string values, you have to write them inside single quotes. Like 'ABBA', 'Toxic' etc. Check carefully string values in the condition statements: no extra spaces, correct capitalization (for example, Britney Spears is correct, not BRITNEY SPEARS or britney spears). Otherwise, you'll receive the Internal Server Error.

Tarea

Select all records with Britney Spears as a singer. Change your query to select only Britney Spears songs' titles (not full records, only column title).

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. 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
some-alt