Inserting a Column to preexisting table in phpmyad

2019-02-16 05:22发布

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

6条回答
Juvenile、少年°
2楼-- · 2019-02-16 05:55

You want something like:

ALTER TABLE contacts ADD email VARCHAR(60);
查看更多
三岁会撩人
3楼-- · 2019-02-16 05:56

I think this video can help you. With 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

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

ALTER TABLE mytable ADD column3 INT AFTER column1
查看更多
Lonely孤独者°
4楼-- · 2019-02-16 06:01

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.

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

查看更多
Emotional °昔
5楼-- · 2019-02-16 06:02

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

enter image description here

查看更多
Fickle 薄情
6楼-- · 2019-02-16 06:07

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.

查看更多
劳资没心,怎么记你
7楼-- · 2019-02-16 06:12

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

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

The AFTER clause defines the position where your new column will come.

查看更多
登录 后发表回答