Tuesday, September 3, 2013

important tips for writing sql queries

some tips to remember while writing sql queries

- avoid using * to select columns from a table, instead use column names like select col1,col2 etc., it will improve the performance of sql query
- use [ ] for column names to avoid conflict with pre-defined key words
- use upper case letters for all predefined types, like SELECT [col1] FROM [TableName]
- use COUNT(ColName) insteaed of using SELECT COUNT(*) from a table
- avoid/Minimize the  use of set of sub queries, because it may affect on performance.

No comments:

Post a Comment