Last active
May 27, 2018 16:34
-
-
Save ateneva/afbfebdcbfdbcf31c4ca0b2ec6e9f420 to your computer and use it in GitHub Desktop.
How do I get part of a string with SQL? (part 2)
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
-----------------------SQL server------------------------------- | |
select | |
'I love you' as phrase, | |
substring('I love you', 3,4) as phrase2 | |
phrase |phrase2 | | |
-----------|--------| | |
I love you |love | | |
-----------------------PostgreSQL-------------------------------- | |
select | |
'I love you' as phrase, | |
substring('I love you', 3,4) as phrase2, | |
substr('I love you', 3,4) as phrase3 | |
phrase |phrase2 |phrase3 | | |
-----------|--------|--------| | |
I love you |love |love | | |
------------------------MySQL------------------------------------- | |
select | |
'I love you' as phrase, | |
substring('i love you', 3, 4) as phrase2, | |
substr('I love you.', 3, 4) as phrase3 | |
phrase |phrase2 |phrase3 | | |
-----------|--------|--------| | |
I love you |love |love | | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment