首页 > 学院 > 开发设计 > 正文

【技巧】SQL中修改列名(column)

2019-11-08 00:43:10
字体:
来源:转载
供稿:网友

问:怎么修改MySQL中的表格的某列的列名?

答:比如说我想将seat表中的seatid列名修改为 seat_id;

1、初状态:

输入:select * from seat; 查看seat 表的 整体状态;

2、输入修改列名语句:

语句:alter table + seat+ change column    +seatid  + seat_id + int;

格式:alter table 表名 change column 旧列名 新列名  新列名格式;

3、末状态:

输入:select*from seat;查看seat表格的状态;

大家可以看到,第一列的列名从seatid变为seat_id了;


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表