摘要: 创建表的时候指定约束 primary key 主键 not null 非空 default '123' 默认 unique 唯一 constraint fk_cid foreign key(lie2) references bookcategory(category_id) 外键 on delete 阅读全文
posted @ 2020-09-10 20:11 短戈行 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 1 . 非空约束 非空约束(Not Null constraint),指字段的值不能为空。对于使用了非空约束的字段如果用户在添加数据时,没有指定值,数据库系统会报错。语法规则:列名 数据类型 NOT NULL 创建表的时候指定非空约束 create table player( player_id i 阅读全文
posted @ 2020-09-10 01:23 短戈行 阅读(368) 评论(0) 推荐(0) 编辑
摘要: 增 insert into player values(1,'name','other'); insert into player (name,club) values ('abc','123'); 外键关联查询示例: c.* 查询的范围 player p,club c关联的两表,分别取名 p.cl 阅读全文
posted @ 2020-09-10 00:31 短戈行 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 检查数据库是否支持表分区 show plugins; partition ACTIVE STORAGE ENGINE NULL GPL这项表示支持 创建分区表 create table bookinfo( book_id int, book_name varchar(20) ) partition 阅读全文
posted @ 2020-09-10 00:26 短戈行 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 建表 create table player( id int identity, card_id char(18), name varchar(10), sex enum('男','女'), age tinyint, tel char(11), balance decimal(7,3) ); 查看数 阅读全文
posted @ 2020-09-10 00:24 短戈行 阅读(155) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-09-10 00:05 短戈行 阅读(3) 评论(0) 推荐(0) 编辑