Last active
June 14, 2024 19:43
-
-
Save rdmershon/b0cbd22d0078740e654db77ce526cfdb to your computer and use it in GitHub Desktop.
SQL Shortcuts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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