Best Practice in SQL

1)      Avoid searching based on concatenation

Select * from employee where empno || name = ’1234qiao’

Select * from employee where empno=1234 and name = ’qiao’

2)      It is advisable to put the table that returns the fewest rows at the end of the From list.

Select * from table1, table2

Table1 – contains 10000,               Table2 – contains 100

3)      If more than one table is used in a query, then it is advisable to use table aliases, as it would enhance the speed of parse phase of the query.

4)      Avoid using NOT or != operators, it causes full table scan.

5)      Using EXISTS instead of IN when the selective filters are in parent query.

6)      Using IN instead of EXISTS when the selective filters are in sub query.

阅读更多
文章标签: table query sql
个人分类: ORACLE 学习笔记
想对作者说点什么? 我来说一句

Git.Best.Practices.Guide.1783553731

2015年04月15日 2.17MB 下载

SAP BEST PRACTICE

2011年12月12日 1.56MB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭