惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
T
Tailwind CSS Blog
D
Docker
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Google DeepMind News
Google DeepMind News
腾讯CDC
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
U
Unit 42
The Cloudflare Blog
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
爱范儿
爱范儿
Recent Announcements
Recent Announcements
博客园 - 聂微东
博客园 - 叶小钗
H
Help Net Security
MyScale Blog
MyScale Blog

博客园 - Augur

又开始使用,学习 Integer和int Mybatis的学习1 初次安装与错误排除 知乎的 Java开发中的23种设计模式(转) vo与po entityVo对象与entity对象 dao 网上Java总结 dto vo html css col-md-offset VUE - 相对路径 转:防止跨站攻击,安全过滤 Java中的包装数据类型 一些名词 数据表 键值定义 楚乔传 Princess Agents Java学习08 (第一遍) - SpringMVC
mysql 表结构
Augur · 2017-07-26 · via 博客园 - Augur

1.登录数据库
>mysql -u root -p 数据库名称

2.查询所有数据表
>show tables;

3.查询表的字段信息
>desc 表名称;

4.1添加表字段

alter table table1 add transactor varchar(10) not Null;

alter table   table1 add id int unsigned not Null auto_increment primary key

4.2.修改某个表的字段类型及指定为空或非空
>alter table 表名称 change 字段名称 字段名称 字段类型 [是否允许非空];
>alter table 表名称 modify 字段名称 字段类型 [是否允许非空];

>alter table 表名称 modify 字段名称 字段类型 [是否允许非空];

4.3.修改某个表的字段名称及指定为空或非空
>alter table 表名称 change 字段原名称 字段新名称 字段类型 [是否允许非空

4.4如果要删除某一字段,可用命令:ALTER TABLE mytable DROP 字段 名;

建表:

DROP TABLE IF EXISTS bulletin;

CREATE TABLE bulletin(
 id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,             # 主键
 uid INT(11) NOT NULL DEFAULT 0,    # 创建者id
 context VARCHAR(600) NOT NULL DEFAULT '',  # 公告详细内容(300字)
 begintime DEC(20) NOT NULL DEFAULT 0,   # 公告开始时间
 endtime DEC(20) NOT NULL DEFAULT 0,   # 公告结束时间
 createtime DEC(20) NOT NULL DEFAULT 0,   # 创建时间
 modifytime DEC(20) NOT NULL DEFAULT 0   # 修改时间

 PRIMARY KEY (`Id`),
)DEFAULT CHARSET=UTF8 TYPE=INNODB;