RIGHT

From SQLZOO
Revision as of 13:45, 16 July 2012 by Connor (Talk | contribs) (Created page with "<table align='right' border='1'> <caption>Compatibility</caption> <tr><th colspan='3'>RIGHT(s,i)</th></tr> <tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''<...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Compatibility
RIGHT(s,i)
EngineOKAlternative
ingresYes
mysqlYes
oracleNoSUBSTR(s, -i)
postgresNoSUBSTRING(s , 1+LENGTH(s)-i , i)
sqlserverYes

RIGHT

RIGHT(s,n) allows you to extract n characters from the end of the string s.

   RIGHT('Hello world', 4) -> 'orld'      
SELECT name,
       SUBSTRING(name, 1+LENGTH(name)-3, 3)
  FROM bbc
SELECT name,
       SUBSTR(name, -3)
  FROM bbc
SELECT name,
       RIGHT(name, 3)
  FROM bbc

See also