ubuntukylin_mysql5.7基础 改一个列的名字
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntukylin_mysql5.7基础 改一个列的名字相关的知识,希望对你有一定的参考价值。
镇场文:
学儒家经世致用,行佛家普度众生,修道家全生保真,悟易理象数通变。以科技光耀善法,成就一良心博客。
______________________________________________________________________________________________________
Operating System:UbuntuKylin 16.04 LTS 64bit
mysql: Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using EditLine wrapper
step1:
查看表的结构
mysql> describe Using_Engineer; +------------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+----------+------+-----+---------+-------+ | ID_Engineer | char(5) | NO | PRI | NULL | | | Using_Engineer | bit(1) | NO | | NULL | | | Time_Build_STM | char(16) | NO | | NULL | | | Time_Abandon_STM | char(16) | YES | | NULL | | +------------------+----------+------+-----+---------+-------+ 4 rows in set (0.00 sec)
step2:
改一个列的名字
mysql> alter table Using_Engineer change Time_Build_STM Time_Build_Engineer char(16) not null; Query OK, 0 rows affected (0.08 sec) Records: 0 Duplicates: 0 Warnings: 0
注: Using_Engineer:表名 Time_Build_STM:旧列名 Time_Build_Engineer char(16) not null:新列名及其属性
step3:
mysql> describe Using_Engineer; +---------------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------+----------+------+-----+---------+-------+ | ID_Engineer | char(5) | NO | PRI | NULL | | | Using_Engineer | bit(1) | NO | | NULL | | | Time_Build_Engineer | char(16) | NO | | NULL | | | Time_Abandon_STM | char(16) | YES | | NULL | | +---------------------+----------+------+-----+---------+-------+ 4 rows in set (0.00 sec)
______________________________________________________________________________________________________
若是您觉得此博文有可以改进的地方或者内容过时了,请评论,我会仔细思考的。
注:此博文仅用于科研学习,如果侵犯到您的权益,请及时告知,我会做出相应的处理。
本文出自 “心静如水,志刚如磐.” 博客,请务必保留此出处http://xinjingzhigang.blog.51cto.com/12262830/1905569
以上是关于ubuntukylin_mysql5.7基础 改一个列的名字的主要内容,如果未能解决你的问题,请参考以下文章