Skip to content

Instantly share code, notes, and snippets.

@rdmershon
Last active June 14, 2024 19:43
Show Gist options
  • Select an option

  • Save rdmershon/b0cbd22d0078740e654db77ce526cfdb to your computer and use it in GitHub Desktop.

Select an option

Save rdmershon/b0cbd22d0078740e654db77ce526cfdb to your computer and use it in GitHub Desktop.
SQL Shortcuts
#Select for a column between a range of values
SELECT *
FROM invoice
WHERE total BETWEEN 15 AND 25;
#Match where values are like ue in city column
SELECT *
FROM customer
WHERE city like '%ue%';
#Find for array of values in column
SELECT *
FROM customer
WHERE country IN ('Brazil', 'Canada', 'USA');
Match with AND boolean
SELECT *
FROM customer
WHERE email like '%gmail.com%'
AND country = 'Canada';
###Match value in column in table
SELECT * FROM Customers
WHERE City = 'Berlin'
###Match not value in column
SELECT * FROM Census
WHERE State = 'Ohio';
##Match specific value in database with boolean AND
SELECT * FROM Customers
WHERE City = 'Cleveland'
AND Postalcode = 43001
SELECT * FROM Customers
WHERE Football = 'JoeBurrow'
OR Football = 'TomyNrady'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment