程序媛计划——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 ...
随机推荐
- .NET Utils 辅助类
using System;using System.Diagnostics;using System.IO;using System.Reflection;using System.Runtime.I ...
- iptables-save和iptables-restore
iptables-save用来把当前的规则存入一个文件里以备iptables-restore使用.它的使用很简单,只有两个参数: iptables-save [-c] [-t table] 参数-c的 ...
- 调用父类构造器:super
import static java.lang.System.*; class Base{ public String name; public double weight; public Base( ...
- laravel表单图片上传
1.视图 2.控制器
- 安卓编译 translate error Lint: How to ignore “<key> is not translated in <language>” errors?
Add following at the header of your strings.xml file <resources xmlns:tools="http://schemas. ...
- Winform窗体控件级权限处理
公共类: static class PowerHelper { /// <summary> /// 设置form上的组件的权限 /// ...
- Oracle连接字符串大全
// 在 C# 代码中用以下数据库提供程序访问 Oracle 数据库 // Oracle Data Provider for .NET / ODP.NET 使用 TNS 写法 Data Source= ...
- xampp虚拟主机的配置
ps:来源 https://blog.csdn.net/qq_17335153/article/details/52091869 一.修改httpd.conf 文件目录 xampp => ...
- DB2 runstats、reorgchk、reorg 命令【转载】
1.runstats runsats可以搜集表的信息,也可以搜集索引信息.作为runstats本身没有优化的功能,但是它更新了统计信息以后,可以让DB2优化器使用最新的统计信息来进行优化,这样优化的效 ...
- Netty学习第五节实例进一步学习
概念理解: Netty是基于NIO的框架 传统IO与NIO的区别: 1.传统IO会造成阻塞点: 2.单一的客户端处理消息 解决阻塞问题:建立线程池,达到收到一个消息就建立一个 ...