Last active
January 13, 2021 07:07
-
-
Save shredder47/c2880026cd02300f01fd98e0f57f866c 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
--------------- | |
SUBSTRING_INDEX | |
--------------- | |
SUBSTRING_INDEX(column_name,' ' , 1) // Not 0 Indexed! | |
-------- | |
to_date | |
-------- | |
to_date(col_with_date_as_string,'MM/yyyy') //parse date string to date type using the specified format - Returns it as yyyy-MM-dd | |
------------ | |
IN statement | |
------------ | |
SELECT 2 IN (1,2,3,4) -> 1 | |
SELECT 5 IN (1,2,3,4) -> 0 | |
usage-- | |
SELECT IF((SELECT 2 IN (1,2,3,4)),'Found','Not Found') -> Found | |
SELECT IF((SELECT 55 IN (1,2,3,4)),'Found','Not Found') -> Not Found | |
------------------------ | |
GREATEST statement | |
------------------------ | |
GREATEST(3, 12, 34, 8, 25) -> 34 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment