简体   繁体   中英

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:
    print table.name 

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.

"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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM