Search code examples
mysqldatabase-designinformation-schema

MySQL Update of Columns using INFORMATION_SCHEMA - is this possible?


I know that I can view the properties and do some amazing things to learn my db/table/field structure using INFORMATION_SCHEMA.

However, is it possible to update a field value in for example the COLUMNS table and thus update the actual column? For example setting nullable from NO to YES.

If this is not directly possible, I realize that I could use the query to CONCAT an ALTER string and then run those strings. However is there in that case a way to instead run an eval() command to do this in one operation? Thanks.


Solution

    1. To learn INFORMATION_SCHEMA: I'd start from reading documentation - INFORMATION_SCHEMA Tables. Then I'd try to edit objects and see what happens in these tables.
    2. INFORMATION_SCHEMA tables are system tables, they cannot be modified. ALTER TABLE is the only way to change a table.