更新地址 SET `Street`=REPLACE(`Street`,'\','');" - 如何在 mysql 中转义 \?

UPDATE Adressen SET `Straße`=REPLACE(`Straße`,'\','');" - How to escape \ in mysql?

我正在使用 https://www.mysqltutorial.org/mysql-string-replace-function.aspx 但我无法替换:\

我在 MacOS 上使用 DBeaver。

它与其他字母一起工作:

UPDATE products 
SET 
    productDescription = REPLACE(productDescription,
        'abuot',
        'about');

但这不起作用:

UPDATE products 
SET 
    productDescription = REPLACE(productDescription,
        '\',
        '');

您必须使用双反斜杠 (\) 转义反斜杠 (\):

UPDATE products SET productDescription = REPLACE(productDescription, '\', '');

demo on dbfiddle.uk

您可以在 the MySQL documentation 上找到包含所有特殊字符的列表(Table 9.1 特殊字符转义序列)。