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

Зміст курсу

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.

Завдання

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 desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 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.

Завдання

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 desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 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.

Завдання

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 desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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.

Завдання

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 desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 5
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
some-alt