Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding new column via MySQL Workbench into existing table

Tags:

I have existing table which is called 'person', I want to add via MySQL Workbench new column into it, for example column 'age'. How can I manage this operation using this program, where and what I need to write? I found query like this, should it works?

e.g. ALTER TABLE person ADD age INT(3);
like image 226
chebad Avatar asked Oct 13 '17 07:10

chebad


People also ask

How do I add a column to an already created table?

The basic syntax of an ALTER TABLE command to add a New Column in an existing table is as follows. ALTER TABLE table_name ADD column_name datatype; The basic syntax of an ALTER TABLE command to DROP COLUMN in an existing table is as follows.

Can we add column to the existing table?

The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used to add and drop various constraints on an existing table.

How do I manually add a column to a MySQL table?

Use ADD to add new columns to a table, and DROP to remove existing columns. DROP col_name is a MySQL extension to standard SQL. To add a column at a specific position within a table row, use FIRST or AFTER col_name . The default is to add the column last.

How do you add a new column and its data type to an existing table?

Use the ALTER TABLE ADD statement to add one or more columns to an existing table. Syntax: ALTER TABLE [schema_name.] table_name ADD column_name1 data_type constraint, column_name2 data_type constraint ...


1 Answers

I don't know if Stackoverflow is proper place to such question, but...

Click on the table you want to change (using right mouse button) and choose "Alter table" (schemas and tables lists are on the left).

enter image description here

In the opened tab you can add or change columns (GUI is very simple and intuitive).

enter image description here

Don't forget to save changes by clicking "Apply".

like image 86
Anad Avatar answered Sep 24 '22 00:09

Anad