Course Content
Data Manipulation using SQL
Data Manipulation using SQL
SQL Exists Statement
The EXISTS operator is a logical operator which returns TRUE if there is at least one element in the query and FALSE in another case. The next query returns all albums after 2008 first, and if at least such an album exists, retrieves all the songs:
SELECT title FROM songs WHERE EXISTS (SELECT id FROM albums WHERE year > 2008)
We can also use NOT EXISTS
. This operator can be used as an additional logical condition after the WHERE statement.
Thanks for your feedback!
SQL Exists Statement
The EXISTS operator is a logical operator which returns TRUE if there is at least one element in the query and FALSE in another case. The next query returns all albums after 2008 first, and if at least such an album exists, retrieves all the songs:
SELECT title FROM songs WHERE EXISTS (SELECT id FROM albums WHERE year > 2008)
We can also use NOT EXISTS
. This operator can be used as an additional logical condition after the WHERE statement.
Thanks for your feedback!
SQL Exists Statement
The EXISTS operator is a logical operator which returns TRUE if there is at least one element in the query and FALSE in another case. The next query returns all albums after 2008 first, and if at least such an album exists, retrieves all the songs:
SELECT title FROM songs WHERE EXISTS (SELECT id FROM albums WHERE year > 2008)
We can also use NOT EXISTS
. This operator can be used as an additional logical condition after the WHERE statement.
Thanks for your feedback!
The EXISTS operator is a logical operator which returns TRUE if there is at least one element in the query and FALSE in another case. The next query returns all albums after 2008 first, and if at least such an album exists, retrieves all the songs:
SELECT title FROM songs WHERE EXISTS (SELECT id FROM albums WHERE year > 2008)
We can also use NOT EXISTS
. This operator can be used as an additional logical condition after the WHERE statement.