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);
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.
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.
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.
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 ...
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).
In the opened tab you can add or change columns (GUI is very simple and intuitive).
Don't forget to save changes by clicking "Apply".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With