今天在写一个sql时,遇到这么个问题,where条件多写了几个,结果结果执行计划显得很槽糕:
表A 有字段 heard_id,class_no,bath_no,class_name
表B有字段 heard_id,class_no,bath_no,class_value
首先A表与B表是通过heard_id相关联,首先得承认这2个表设计有点问题,不满足范式的要求,有冗余的信息,如class_no,bath_no,结果我在写写sql时写成这个样子:
select a.class_no,a.batch_no,a.class_name,b,class_value
from a,b