标签:
 * 总结:
 * 1.为什么要拆表?
 * 去除冗余数据  (重复数据)
 * 2.添加外键解决了什么问题?关键字  constraint 约束        foreign  key  外键        references相关联
 * 解决了插入数据的完整性(正确性和准确性)
 * 例:   constraint croe_sid foreign key(sid) references student(id)
 * 
 * 第二种: alter table core add constraint croe_sid foreign key(sid) references student(id)
 * 
 * 3.表与表之间的关系?
 * 一对一   一对多(多对一)  多对多
 * 4.多表查询?
 * 内连接:关键字_(inner)join   on 
 *         普通话:select * from student s join core c on s.stuid=c.cid
 *         方言:select * from student s,core.c where s.stuid = c.cid
 * 外连接:  关键字——(outer)join on
 *         左外连接:left join on
 *             select * from student s left join croe.c on s.stuid= c.cid
 *         右外连接:right join on  同上
 * 
 *     隐式内连接 :当一个表不能满足 ,使用这个语句
 *     select* from student s,croe c where s.stuid=c.id and cc.croe=67;
 * 子查询:一个表可以满足 ,(select里面嵌套一个select语句)
 * 
标签:
原文地址:http://www.cnblogs.com/linjiarui/p/5654971.html