1、查询的关联同写的顺序 :
select a.personMemberID, * from chineseresume a,personmember b
where personMemberID = b.referenceid and a.personMemberID = ‘JCNPRH39681’ (A = B ,B = ‘号码’)
select a.personMemberID, * from chineseresume a,personmember b
where a.personMemberID = b.referenceid and a.personMemberID = ‘JCNPRH39681’ and b.referenceid = ‘JCNPRH39681’ (A = B ,B = ‘号码’, A = ‘号码’)
select a.personMemberID, * from chineseresume a,personmember b
where b.referenceid = ‘JCNPRH39681’ and a.personMemberID = ‘JCNPRH39681’ (B = ‘号码’, A = ‘号码’)
2、尽量使用exists代替select count(1)来判断是否存在记录,count函数只有在统计表中所有行数时使用,而且count(1)比count(*)更有效率。
3、尽量使用“>=”,不要使用“>”。
4、索引的使用规范:
索引的创建要与应用结合考虑,建议大的OLTP表不要超过6个索引&