Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
SQL And, Or, Not | 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 And, Or, Not

To combine multiple conditions, use AND, OR, and NOT keywords, and also brackets (, ) to set the priority.

For example, you want to select all songs' titles, that were produced between 1970 and 1990 years:

12
SELECT title FROM songs WHERE year >= 1970 AND year <= 1990
copy

Or you can select all records where singer is not Pink Floyd:

12
SELECT * FROM songs WHERE NOT singer = 'Pink Floyd'
copy

You can combine conditions for different columns, but not forget about brackets to define the priority:

12
SELECT * FROM songs WHERE NOT (singer = 'Pink Floyd' AND price = 100)
copy

Завдання

Find all songs titles and prices of 20th century, where the price is less than 500, or where the singer is AC/DC.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

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

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

Секція 1. Розділ 7
toggle bottom row

bookSQL And, Or, Not

To combine multiple conditions, use AND, OR, and NOT keywords, and also brackets (, ) to set the priority.

For example, you want to select all songs' titles, that were produced between 1970 and 1990 years:

12
SELECT title FROM songs WHERE year >= 1970 AND year <= 1990
copy

Or you can select all records where singer is not Pink Floyd:

12
SELECT * FROM songs WHERE NOT singer = 'Pink Floyd'
copy

You can combine conditions for different columns, but not forget about brackets to define the priority:

12
SELECT * FROM songs WHERE NOT (singer = 'Pink Floyd' AND price = 100)
copy

Завдання

Find all songs titles and prices of 20th century, where the price is less than 500, or where the singer is AC/DC.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

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

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

Секція 1. Розділ 7
toggle bottom row

bookSQL And, Or, Not

To combine multiple conditions, use AND, OR, and NOT keywords, and also brackets (, ) to set the priority.

For example, you want to select all songs' titles, that were produced between 1970 and 1990 years:

12
SELECT title FROM songs WHERE year >= 1970 AND year <= 1990
copy

Or you can select all records where singer is not Pink Floyd:

12
SELECT * FROM songs WHERE NOT singer = 'Pink Floyd'
copy

You can combine conditions for different columns, but not forget about brackets to define the priority:

12
SELECT * FROM songs WHERE NOT (singer = 'Pink Floyd' AND price = 100)
copy

Завдання

Find all songs titles and prices of 20th century, where the price is less than 500, or where the singer is AC/DC.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

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

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

To combine multiple conditions, use AND, OR, and NOT keywords, and also brackets (, ) to set the priority.

For example, you want to select all songs' titles, that were produced between 1970 and 1990 years:

12
SELECT title FROM songs WHERE year >= 1970 AND year <= 1990
copy

Or you can select all records where singer is not Pink Floyd:

12
SELECT * FROM songs WHERE NOT singer = 'Pink Floyd'
copy

You can combine conditions for different columns, but not forget about brackets to define the priority:

12
SELECT * FROM songs WHERE NOT (singer = 'Pink Floyd' AND price = 100)
copy

Завдання

Find all songs titles and prices of 20th century, where the price is less than 500, or where the singer is AC/DC.

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