摘要: 1. 多表查询 1.1 交叉连接--笛卡儿积 将两表所有的数据一一对应,生成一张表。 耗内存、资源。 #表1是主表,表2是从表, select * from 表1,表2; # 连表,全关联,将两张表连在一起(可能有重复字段) select * from 表1,表2 where 表1.id=表2.pi 阅读全文
posted @ 2019-09-03 20:08 SensorError 阅读(316) 评论(0) 推荐(0) 编辑
摘要: 1. 修改、删除被关联字段 主表(父表)、从表(子表) show create table 从表; # 查看外键名称 create table t1(id int, pid int constraint 名字 foreign key(关联字段) reference 主表(被关联字段) ; # 创建外 阅读全文
posted @ 2019-09-03 20:07 SensorError 阅读(243) 评论(0) 推荐(0) 编辑