Skip to content

Instantly share code, notes, and snippets.

@douglarek
Created May 9, 2014 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglarek/ff90bf815a349fc36963 to your computer and use it in GitHub Desktop.
Save douglarek/ff90bf815a349fc36963 to your computer and use it in GitHub Desktop.
MySQL Tutorial.
mysql修改表名,列名,列类型,添加表列,删除表列
修改表名(设表明为testtable,将其命名为newtablename)
alter table testtable rename newtablename;
添加表列:
alter table testtable add column name varchar(40);
删除列:
alter table testtable drop column name;
修改列的类型:
alter table testtable modify address char(40)
或者这样:alter table testtable change address address char(40)
修改表列名
alter table testtable change column address address1 varchar(30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment