程序媛计划——mysql修改表结构
#查看表的结构
mysql> desc score;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(4) | NO | PRI | NULL | auto_increment |
| name | char(20) | NO | | NULL | |
| score | double(16,2) | YES | | NULL | |
| evaluation | char(20) | YES | | normal | |
+------------+--------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
#alter对字段操作
#添加字段
mysql> alter table exam_score add other int(4) default 10;
Query OK, 0 rows affected (0.05 sec)
Records: 0 Duplicates: 0 Warnings: 0
#修改字段变为另一个字段
mysql> alter table exam_score change other evaluation char(20) default 'normal';
Query OK, 4 rows affected (0.02 sec)
Records: 4 Duplicates: 0 Warnings: 0
#删除字段(即删除字段中的所有数据)
mysql> alter table exam_score drop column other;
Query OK, 0 rows affected (0.05 sec)
Records: 0 Duplicates: 0 Warnings: 0
#修改表名
mysql> rename table exam_score to score;
Query OK, 0 rows affected (0.01 sec)
程序媛计划——mysql修改表结构的更多相关文章
- 程序媛计划——mysql连接表
#inner join等值连接/内连接 mysql> select * from info; +------+-------------+----------+ | name | phone | ...
- mysql修改表结构语句
mysql alter 用法,修改表,字段等信息 一: 修改表信息 1.修改表名 alter table test_a rename to sys_app; 2.修改表注释 alter table ...
- MYSQL 修改表结构基本操作一览
查看表的字段信息:desc 表名; 查看表的所有信息:show create table 表名; 添加主键约束:alter table 表名 add constraint 主键 (形如:PK_表名) ...
- Mysql修改表结构详解
添加字段: alter table `user_movement_log`Add column GatewayId int not null default 0 AFTER `Regionid` (在 ...
- mysql 修改表结构以支持事务操作
修改表的类型为 INNODB 的 SQL: alter table category_ ENGINE = innodb; 查看表的类型的 SQL show table status from ...
- 程序媛计划——mysql 插入、查找、修改、删除数据
#插入.查找数据 [mysql>create table if not exists exam_score( ..>id int(4) not null primary key auto_ ...
- 程序媛计划——mysql基本操作
本文适用于mac 在官网上下载community 版mysql,选择dmy这种.在终端中安装好mysql. #进入mysql /usr/local/mysql/bin/mysql -uroot -p ...
- 程序媛计划——mysql索引
定义: 索引是一种单独的.物理的对数据库表中一列或多列的值进行排序的一种存储结构 #为字段创建索引 #在表中的字段中创建索引mysql> create index ind_score on ...
- mysql 修改表结构、表字段注释语句
虽然现在有各种各样的工具可以直接对表结构进行修改,但是我还是喜欢使用语句进行修改.以下语句是对表增加字段.给字段加注释的语句 alter table orders add column isupdyq ...
随机推荐
- TextView 小技巧
1.TextView的单行显示 最后空间不够的画变为省略号显示 textView中让结尾变为省略号android:ellipsize = "end" 省略号在结尾tv.setEll ...
- xp安装vmware10时一直停在installing packages on the system
我估计的原因是: vm会在网上邻居(LAN或高速internet)下创建两个 vmware network adapter vmnet8 vmware network adapter vmnet1 ...
- 欲哭无泪的p-value = 0.051 | 做几次重复能得到较低的p-value
欲哭无泪的p-value = 0.051 | 做几次重复能得到较低的p-value 已有 1469 次阅读 2017-12-15 14:12 |个人分类:RNA-seq|系统分类:科普集锦|关键词:R ...
- Ubuntu下的网络服务
一.Telnet Telnet是teletype network的缩写,表示远程登录协议和方式,分为Telnet客户端和Telnet服务器程序. Telnet服务虽然也属于客户机/服务器模型的服务,但 ...
- Codeforces 679B. Barnicle 模拟
B. Barnicle time limit per test: 1 second memory limit per test :256 megabytes input: standard input ...
- VK Cup 2016 D. Bear and Two Paths 模拟
D. Bear and Two Paths time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- [Selenium]验证点了某个Button之后无反应
期望:点了某个Button,无反应 问题:怎么去验证无反应 WebElement webElement = page.getICORemove(); SeleniumUtil.hover(page.g ...
- ip白名单 通过* ? 检测IP匹配 轻量级
#include "stdafx.h" #include <windows.h> #include <string.h> #include <asse ...
- 换行符在HTML中直接替换为<br>
#set($text=$!obj.getMeasure().replaceAll("\r\n","<br>")) <td a ...
- 657. Judge Route Circle
static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { publ ...