Difference between revisions of "SQL String operators"
From Lianjapedia
Helen.george (Talk | contribs) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
String operators | String operators | ||
− | |||
==Syntax== | ==Syntax== | ||
<expression1> operator <expression2>[ operator <expression3>…] | <expression1> operator <expression2>[ operator <expression3>…] | ||
− | |||
==See Also== | ==See Also== | ||
[[SQL INSERT|INSERT]], [[SQL OPERATORS|OPERATORS]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]] | [[SQL INSERT|INSERT]], [[SQL OPERATORS|OPERATORS]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]] | ||
− | |||
==Description== | ==Description== | ||
Operators used with Character expressions: | Operators used with Character expressions: | ||
− | + | {| class="wikitable" width="100%" | |
− | + | ||
− | {| class="wikitable" | + | |
!Operator||Operation | !Operator||Operation | ||
|- | |- | ||
− | |<nowiki>||</nowiki>||Concatenate the <expression2> to the end of the <expression1> string | + | |valign="top"|<nowiki>||</nowiki>||Concatenate the <expression2> to the end of the <expression1> string |
|- | |- | ||
− | |<nowiki>+</nowiki>||Concatenate the <expression2> to the end of the <expression1> string | + | |vaign="top"|<nowiki>+</nowiki>||Concatenate the <expression2> to the end of the <expression1> string |
|- | |- | ||
− | |<nowiki>-</nowiki>||The <expression1> string is trimmed of trailing spaces, the <expression2> string is concatenated to the end of the <expression1> string and the previously trimmed spaces concatenated to the end of the <expression2> string | + | |valign="top"|<nowiki>-</nowiki>||The <expression1> string is trimmed of trailing spaces, the <expression2> string is concatenated to the end of the <expression1> string and the previously trimmed spaces concatenated to the end of the <expression2> string |
|- | |- | ||
|} | |} | ||
− | |||
==Example== | ==Example== | ||
Line 36: | Line 30: | ||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL|Operators,String]] | [[Category:SQL|Operators,String]] |
Latest revision as of 11:37, 30 January 2013
Contents
Purpose
String operators
Syntax
<expression1> operator <expression2>[ operator <expression3>…]
See Also
INSERT, OPERATORS, SELECT, UPDATE
Description
Operators used with Character expressions:
Operator | Operation |
---|---|
|| | Concatenate the <expression2> to the end of the <expression1> string |
+ | Concatenate the <expression2> to the end of the <expression1> string |
- | The <expression1> string is trimmed of trailing spaces, the <expression2> string is concatenated to the end of the <expression1> string and the previously trimmed spaces concatenated to the end of the <expression2> string |
Example
SELECT trim(title) || ’ ’ || last_name as "Full Name"; FROM customers; ORDER BY last_name