SQL > SQL????? > Substring

SQL ?? substring ??? ??? ?? ????? ???? ?? ??????.??? ???????? ? ??? ??? ??? ????.

  • MySQL: SUBSTR( ), SUBSTRING( )
  • Oracle: SUBSTR( )
  • SQL Server: SUBSTRING( )
?? ?? ???? ??? ??? ??(??? ???SUBSTR( )? ?? ??):

SUBSTR (str, pos)

<str> ??,? <pos> ??? ?? ???? ?? ????? ?????.? ???SQL Server? ???? ????? ???? ????.

SUBSTR (str, pos, len)

<str> ?? ? <pos> ????? ???? ???? <len>? ????? ?????.

???? ?? ??? ??? ????:

Geography ??
Region_NameStore_Name
EastBoston
EastNew York
WestLos Angeles
WestSan Diego

? 1

SELECT SUBSTR (Store_Name, 3)
FROM Geography
WHERE Store_Name = 'Los Angeles';

??:

's Angeles'

? 2

SELECT SUBSTR (Store_Name, 2, 4)
FROM Geography
WHERE Store_Name = 'San Diego';

??:

'an D'

SQL TRIM >>
?


Copyright © 2021   1keydata.com   All Rights Reserved