将列名称更改为 MySQL Table 中的第一行
Change Column names to first row in MySQL Table
我使用 PHPMyAdmin
的 import
选项将 CSV 文件导入为 SQL table(因为我发现这最简单)。现在列名是 "COL 1, COL 2,..." 并且所需的列名是 table.
中的第一行
如何将列名更改为第一行中的值(对于数据库的所有 table)?
Here 是一种一次更改一个列名的方法,但我在数据库的每个 table 中都有太多列名,我想将其应用于所有 table 立即。
有没有比较简单的方法来做到这一点?或者我应该在导入 CSV 文件时尝试合并它吗?
导入时,有一个"The first line of the file contains the table column names (if this is unchecked, the first line will become part of the data)"复选框。
选中该框将使用第一行作为列名,这样您就不必编写任何额外的脚本或手动更改任何内容。
我使用 PHPMyAdmin
的 import
选项将 CSV 文件导入为 SQL table(因为我发现这最简单)。现在列名是 "COL 1, COL 2,..." 并且所需的列名是 table.
如何将列名更改为第一行中的值(对于数据库的所有 table)?
Here 是一种一次更改一个列名的方法,但我在数据库的每个 table 中都有太多列名,我想将其应用于所有 table 立即。
有没有比较简单的方法来做到这一点?或者我应该在导入 CSV 文件时尝试合并它吗?
导入时,有一个"The first line of the file contains the table column names (if this is unchecked, the first line will become part of the data)"复选框。
选中该框将使用第一行作为列名,这样您就不必编写任何额外的脚本或手动更改任何内容。