Skip to content

Instantly share code, notes, and snippets.

@sqldeployhelmet
Last active April 7, 2019 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sqldeployhelmet/fbf51b36bb0775444d6564f337e1667d to your computer and use it in GitHub Desktop.
Save sqldeployhelmet/fbf51b36bb0775444d6564f337e1667d to your computer and use it in GitHub Desktop.
Using simple mathematical operators for filters in SQL
/* films with exactly 2 oscar nominations */
SELECT name, releaseDate
FROM films
WHERE oscarNoms = 2;
/* films with more than 4 oscar nominations*/
SELECT name, releaseDate
FROM films
WHERE oscarNoms > 4;
/* films with 6 or less oscar nominations*/
SELECT name, releaseDate
FROM films
WHERE oscarNoms <= 6;
/* films with any number of oscar nominations except 3 */
SELECT name, releaesDate
FROM films
WHERE oscarNoms <> 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment