mysql删除列语句 mysql删除列的sql语句 | 您所在的位置:网站首页 › mysql删除列名语句 › mysql删除列语句 mysql删除列的sql语句 |
里主要说明关于数据库表中各列的修改: 一、查看列 1、查看各列数据:select 列名,列名 from 表名;或者 select * from 表名; 2、查看各列属性:desc 表名;
二、添加、删除列 1、添加列:alter table 表名 add 列名 数据类型……; 2、删除列:alter table 表名 drop column 列名;
三、修改列 1、修改列名:alter table 表名 change 原列名 新列名 数据类型;
修改数据类型:alter table 表名 modify 列名 新数据类型;
修改主键: (1)添加主键:alter table 表名 add primary key(列名);
(2)删除主键:alter table 表名 drop primary key;
修改自增: (1)添加自增:alter table 表名 modify 列名 int unsigned auto_increment;
(2)删除自增:alter table 表名 change 列名 列名 int;
修改是否为空 (1)允许为空:alter table 表名 modify 列名 数据类型 null; (2)不允许为空:alter table 表名 modify 列名数据类型 not null;
修改默认值 (1)添加、修改默认值:alter table 表名 alter column列名 set default 默认值;
(2)删除默认值:alter table 表名 alter column 列名 drop default;
|
今日新闻 |
推荐新闻 |
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 |