当前位置: 移动技术网 > IT编程>数据库>Mysql > sql在一个表中添加字段并添加备注的方法

sql在一个表中添加字段并添加备注的方法

2019年09月09日  | 移动技术网IT编程  | 我要评论

1、加字段:

alter table 表名 add 字段名 类型;

eg:

alter table sys_cwzd add sccllj varchar2(50); 

 

2、加备注:

comment on column 表名.字段名 is '备注名';

eg:

comment on column sys_cwzd.sccllj is '上传材料路径';

 

内容扩展:

添加新字段:

alter table bulletin add citycode varchar(6) not null default 0; # 城市代码

1.创建数据库时设置编码

create database test character set utf8;

2.创建表时设置编码

create table test(id int primary key)default charset=utf8;

3.修改数据库编码

alter database test character set utf8;

4.修改表默认编码

alter table test character set utf8;

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网