開始使用免費開始

修剪字串 II

在上一個練習中,你使用 TRIM() 移除 airport_name 欄位值前後的空白。

假設因為你使用較舊的 SQL Server 2017 版本而無法使用 TRIM() 函式,所以這次需要改用 LTRIM()RTRIM()

你要如何移除這些多餘的空白?

本練習屬於課程

在 SQL Server 資料庫中清理資料

檢視課程

練習說明

  • 使用合適的函式移除前後的空白。
  • 選取資料所在的來源資料表。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

SELECT 
	airport_code,
	-- Use the appropriate function to remove the extra spaces
    ___(___(___)) AS airport_name,
	airport_city,
    airport_state
-- Select the source table
FROM ___
編輯並執行程式碼