Created
October 27, 2019 14:08
-
-
Save igeligel/4a58593a82fd785629f20571b72c36e0 to your computer and use it in GitHub Desktop.
This file contains 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
# Get all entries like Melissa, Melli. | |
# Not depending on how many characters are wildcarded. | |
SELECT * FROM example_table WHERE example_column LIKE 'Mel%'; | |
# Get all entries like Meli, Melo. | |
# Depending on how many characters are wildcarded. | |
SELECT * FROM example_table WHERE example_column LIKE 'Mel_'; | |
# Or for multiple characters, here 2 | |
SELECT * FROM example_table WHERE example_column LIKE 'Mel__'; | |
# Get all entries which include mel, not case-sensitive. | |
# To match: Melissa, Emelio, Mel | |
SELECT * FROM example_table WHERE LOWER(example_column) LIKE '%mel%'; | |
# With an ILIKE expression | |
SELECT * FROM example_table WHERE example_column ILIKE '%mel%'; | |
# With a regular expression (Regex) | |
SELECT * FROM example_table WHERE example_column ~* 'mel'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment