Skip to content

Instantly share code, notes, and snippets.

@bartubozkurt
Created June 11, 2021 18:34
Show Gist options
  • Select an option

  • Save bartubozkurt/29035d02347a6259025b9331ecc3606a to your computer and use it in GitHub Desktop.

Select an option

Save bartubozkurt/29035d02347a6259025b9331ecc3606a to your computer and use it in GitHub Desktop.
Finds countries that have at least one city:
SELECT name FROM country
WHERE EXISTS (
SELECT *
FROM city
WHERE country_id = country.id
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment