MySQL 将一列插入到 phpmyadmin 中预先存在的表中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18064495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 18:25:55  来源:igfitidea点击:

Inserting a Column to preexisting table in phpmyadmin

mysqlphpmyadmin

提问by StrawhatLuffy

I want to add a column to preexisting table. Can I add it in between two existing columns? I am working on phpmyadmin.

我想向预先存在的表中添加一列。我可以将它添加到两个现有列之间吗?我在 phpmyadmin 上工作。

回答by danmc

Use the add new column after dropdown.

使用下拉列表后添加新列。

  1. Select the database from the menu on the left.

  2. Select the table by clicking on it's title column hyperlink.

  3. Check the add new column after radio button and select the column you want to insert after in the drop down.

  4. Click Add.

  1. 从左侧菜单中选择数据库。

  2. 通过单击其标题列超链接来选择表格。

  3. 选中在单选按钮之后添加新列,然后在下拉列表中选择要插入的列。

  4. 单击添加。

This video goes through the process http://www.youtube.com/watch?v=jZ72GCGWPQg

该视频经历了整个过程http://www.youtube.com/watch?v=jZ72GCGWPQg

回答by Vaughan Hilts

You want something like:

你想要这样的东西:

ALTER TABLE contacts ADD email VARCHAR(60);

回答by hjpotter92

The ordering of columns in MySQLisn't of much importance. As for adding a new column,

MySQL 中列顺序并不重要。至于添加新列,

ALTER TABLE `tblName`
    ADD COLUMN `colName` INT(10) AFTER `firstCol`;

The AFTERclause defines the position where your new column will come.

AFTER子句定义了新列将出现的位置。

回答by Maxime Lorant

I think this videocan help you. With PHPMyAdmin

我认为这个视频可以帮助你。使用 PHPMyAdmin

  1. Go to the page of the table you want to modify
  2. At the bottom of the page, select you desired column in "After" (at which position you want to add your column in the table)
  3. Validate and enter new column information
  1. 转到您要修改的表的页面
  2. 在页面底部,在“之后”中选择您想要的列(您要在表格中添加您的列的位置)
  3. 验证并输入新的列信息

You can also do it via plain SQL, with a ALTER TABLEquery:

您也可以通过普通 SQL 使用ALTER TABLE查询来完成:

ALTER TABLE mytable ADD column3 INT AFTER column1

回答by Shemeer M Ali

Yes, you can do that. See a "after" list box in the section. you can select after which field your new field need to be added.

是的,你可以这样做。请参阅部分中的“之后”列表框。您可以选择需要添加新字段的字段。

回答by LiveaLearn

Even if you have inserted a column in the MySQL, MySQL now provides an option to click on 'move columns' button below the table.

即使您已经在 MySQL 中插入了一列,MySQL 现在也提供了一个选项来单击表下方的“移动列”按钮。

enter image description here

在此处输入图片说明