mysql新建表

1
2
3
4
5
6
7
8
9
CREATE TABLE table(
  id int(20) not null auto_increment primary key, //auto_increment当为空时自动补全,注意,类型应该定义为int,primary key表示当前是主键
  name varchar(20) not null,
  size int(100) not null,
  path varchar(100) not null,
  uploadTime varchar(100) not null,
  userId varchar(30) not null,
  foreign key(userId) references user(id) //userId的类型要和user表中id的类型一致<br><br>
)<br><br>新建表有3种方法<br>1.在mysql中直接写,这种方法不够灵活,有时候单词输入错误后修改及复制之类的不好操作<br>2.可以在外部写好.sql文件,再导入到mysql中,mysql>source c:/xxx/xxx/xxx.sql<br>3.在navicat中选中数据库,点查询,新建查询中写入
 
 
posted @   boyanh  阅读(8467)  评论(0编辑  收藏  举报
编辑推荐:
· 对象命名为何需要避免'-er'和'-or'后缀
· SQL Server如何跟踪自动统计信息更新?
· AI与.NET技术实操系列:使用Catalyst进行自然语言处理
· 分享一个我遇到过的“量子力学”级别的BUG。
· Linux系列:如何调试 malloc 的底层源码
阅读排行:
· C# 中比较实用的关键字,基础高频面试题!
· .NET 10 Preview 2 增强了 Blazor 和.NET MAUI
· 为什么AI教师难以实现
· 如何让低于1B参数的小型语言模型实现 100% 的准确率
· AI Agent爆火后,MCP协议为什么如此重要!
历史上的今天:
2017-10-31 arttemplate
2017-10-31 thymeleaf数组下标
点击右上角即可分享
微信分享提示