Update MySQL field required status.

It’s been a while since I did MySQL stuff on the command line but working on my current goofy project, it’s getting less infrequent. To update the required status of a field in a table use the following:

alter table <table_name> modify <column_name> <column_type> <status>;

where column_type is one of the MySQL types e.g. varchar(700) and status is required (not null) or not (null):

alter table my_special_friends modify twitter_id varchar(145) null;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s