MariaDB 10.6.4で文字列の左側から半角スペースを削除する

環境
MariaDB 10.6.4

書式
LTRIM(値)
LTRIM 関数は引数に指定した文字列の先頭から空白を取り除くために使用します。

使用例

SQL構文

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SELECT
LTRIM(' study') resultA
, LTRIM(' study ') resultB
, LENGTH(LTRIM(' study')) resultC
, LENGTH(LTRIM(' study ')) resultD
SELECT LTRIM(' study') resultA , LTRIM(' study ') resultB , LENGTH(LTRIM(' study')) resultC , LENGTH(LTRIM(' study ')) resultD
SELECT
    LTRIM('  study') resultA
    , LTRIM('  study  ') resultB
    , LENGTH(LTRIM('  study')) resultC
    , LENGTH(LTRIM('  study  ')) resultD

実行結果

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
resultA resultB resultC resultD
study study 5 7
resultA resultB resultC resultD study study 5 7
resultA	resultB	resultC	resultD
study	study  	5	7

 

MariaDB

Posted by arkgame