Difference between revisions of "LEFT"

From SQLZOO
Jump to: navigation, search
 
Line 40: Line 40:
 
   <li>[[POSITION |POSITION function]]</li>
 
   <li>[[POSITION |POSITION function]]</li>
 
</ul>
 
</ul>
 +
 +
{{Languages}}

Latest revision as of 20:37, 22 October 2012

Compatibility
LEFT(s,i)
EngineOKAlternative
ingresYes
mysqlYes
oracleNoSUBSTR(s, 1, i)
postgresNoSUBSTRING(s, 1, i)
sqlserverYes

LEFT

LEFT(s,n) allows you to extract n characters from the start of the string s.

   LEFT('Hello world', 4) -> 'Hell'     
SELECT name,
       SUBSTRING(name, 1, 3)
  FROM bbc
SELECT name,
       SUBSTR(name, 1, 3)
  FROM bbc
SELECT name,
       LEFT(name, 3)
  FROM bbc

See also

Language: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense