将撇号插入 mysql 数据库

Inserting apostrophes into mysql database

我有一个基于三个文本列的 CSV 文件。我们称它们为 A、B、C 列。在 A 列中,我有自由文本,可能在几行中包含撇号。

我想创建一个包含 CSV 文件中所有行的 mysql table。我应该如何处理撇号?

P.S。要创建 mysql table,我计划使用 excel 公式创建插入查询。

来自网站:

There are several ways to include quote characters within a string:

A “'” inside a string quoted with “'” may be written as “''”.

A “"” inside a string quoted with “"” may be written as “""”.

Precede the quote character by an escape character (“\”).

A “'” inside a string quoted with “"” needs no special treatment and need not be doubled or escaped. In the same way, “"” inside a string quoted with “'” needs no special treatment.

所以要么使用两个撇号,要么在前面加上反斜杠。

编辑:我看到你说你正在使用 Excel。我可以根据经验告诉你,引号字符真的很容易混淆,尤其是当两个单引号看起来像一个双引号时。在这种情况下使用反斜杠选项可能更好。