如果需要修改mysql字段的順序,應該怎麼做呢?下面就將為您介紹修改mysql字段順序的方法,原表結構如下:
- CREATE TABLE `tb_area_collect_school_week` (
- `id` char(36) NOT NULL,
- `date_entered` varchar(20) NOT NULL,
- `date_modified` datetime NOT NULL,
- `assigned_user_id` char(36) default NULL,
- `modified_user_id` char(36) default NULL,
- `created_by` char(36) default NULL,
- `name` varchar(50) NOT NULL,
- `description` mediumtext,
- `deleted` tinyint(1) NOT NULL default '0',
- `qy_id` int(10) unsigned NOT NULL auto_increment COMMENT '序號',
- `provinces` varchar(50) default NULL COMMENT '省份',
- `city` varchar(50) NOT NULL COMMENT '地市',
- `school_open_up` int(20) NOT NULL COMMENT '開通學校數',
- `school_cover_percent` varchar(50) NOT NULL COMMENT '覆蓋率',
- `school_count` int(20) NOT NULL COMMENT '學校總數',
- `area` varchar(50) default NULL,
- `date` varchar(10) NOT NULL COMMENT '日期',
- `system` varchar(10) default NULL COMMENT '系統',
- PRIMARY KEY USING BTREE (`id`,`qy_id`),
- KEY `provinces` USING BTREE (`provinces`),
- KEY `city` USING BTREE (`city`),
- KEY `area` USING BTREE (`area`),
- KEY `date` USING BTREE (`date`),
- KEY `SYSTEM` (`system`)
- ) ENGINE=MyISAM DEFAULT CHARSET=gbk
原來表結構是這樣,現在要表結構變成
- CREATE TABLE `tb_area_collect_school_week` (
- `id` char(36) NOT NULL,
- `date_entered` varchar(20) NOT NULL,
- `date_modified` datetime NOT NULL,
- `assigned_user_id` char(36) default NULL,
- `modified_user_id` char(36) default NULL,
- `created_by` char(36) default NULL,
- `name` varchar(50) NOT NULL,
- `description` mediumtext,
- `deleted` tinyint(1) NOT NULL default '0',
- `qy_id` int(10) unsigned NOT NULL auto_increment COMMENT '序號',
- `provinces` varchar(50) default NULL COMMENT '省份',
- `city` varchar(50) NOT NULL COMMENT '地市',
- `area` varchar(50) default NULL,
- `school_open_up` int(20) NOT NULL COMMENT '開通學校數',
- `school_cover_percent` varchar(50) NOT NULL COMMENT '覆蓋率',
- `school_count` int(20) NOT NULL COMMENT '學校總數',
- `date` varchar(10) NOT NULL COMMENT '日期',
- `system` varchar(10) default NULL COMMENT '系統',
- PRIMARY KEY USING BTREE (`id`,`qy_id`),
- KEY `provinces` USING BTREE (`provinces`),
- KEY `city` USING BTREE (`city`),
- KEY `area` USING BTREE (`area`),
- KEY `date` USING BTREE (`date`),
- KEY `SYSTEM` (`system`)
- ) ENGINE=MyISAM DEFAULT CHARSET=gbk
修改mysql字段順序的方法:
- ALTER TABLE `tb_area_collect_school_week` CHANGE `area` `area` VARCHAR(50) AFTER `city` ;
mysql添加刪除主鍵的方法
MySQL修改密碼的六種方法
linux下的常用mysql命令
九種常用mysql命令
MySQL自增字段的常用語句