platinums platinums - 1 year ago 78
MySQL Question

MySQL Workbench - alter database query (Local Connection Database)

I want to run an alter database query on the Schema I am designing in the Workbench software.
is this at all possible?
I want to run this in the Workbench Scripting Shell on the Schema called "BACKDOOR" within the Table called "SATURDAY"

"alter table SATURDAY add column flavor"

It does not work for me though :

File "<string>", line 1
alter table SATURDAY add column flavor
SyntaxError: invalid syntax
Error executing script.

I do not have MySQL Installed on this pc. Im am going on the basis that the code snippets in the Workbench Scripter work fine eg

schema = grt.root.wb.doc.physicalModels[0].catalog.schemata[0]
for table in schema.tables:

This gives me all the table names from the database I'm designing in the Workbench software.
I guess I need to wrap my SQL statement in a similar fashion to the snippet.

Answer Source

"alter table SATURDAY add column flavor"

The proper syntax for adding a column on a table is slightly different in MySQL (MySQL ALTER TABLE examples):

alter table SATURDAY add flavor varchar;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download