1. Main Topic 1
  2. use indexing
  3. best
    1. Don't use "SELECT*" in a SQL query
    2. Avoid unnecessary columns in the SELECT list and unnecessary tables in join conditions
    3. Do not use the COUNT() aggregate in a subquery to do an existence check
      1. use exist
    4. Try to avoid joining between two types of columns
    5. Try to avoid deadlocks
      1. Always access tables in the same order in all your Stored Procedures and triggers consistently
      2. Keep your transactions as short as possible. Touch as few data as possible during a transaction
      3. Never, ever wait for user input in the middle of a transaction
    6. Write TSQL using "Set based approach" rather than "Procedural approach"
      1. How can we get rid of "Procedural SQL"? Follow these simple tricks:
        1. Use inline sub queries to replace User Defined Functions.
        2. Use correlated sub queries to replace Cursor based code.
        3. If procedural coding is really necessary, at least, use a table variable instead of a cursor to navigate and process the result set
    7. Try not to use COUNT(*) to obtain the record count in a table
    8. Try to avoid dynamic SQL
    9. Try to avoid the use of temporary tables
    10. Instead of LIKE search, use full text search for searching textual data
    11. Try to use UNION to implement an "OR" operation
    12. Implement a lazy loading strategy for large objects
    13. Use VARCHAR(MAX), VARBINARY(MAX), and NVARCHAR(MAX)
    14. Implement the following good practices in User Defined Functions
    15. Implement the following good practices in Stored Procedures
    16. Implement the following good practices in Triggers
    17. Implement the following good practices in Views
    18. Implement the following good practices in Transactions
  4. subquery
    1. nested
    2. Correlated