SQL important concept (stay updating)

1. All record with null will not be a part of count.

2. Check if this value is null. Dont use null==null, use null is null.

3. The difference between IN and EXIST:


  • Works on List result set
  • Doesn’t work on subqueries resulting in Virtual tables with multiple columns
  • Compares every value in the result list
  • Performance is comparatively SLOW for larger resultset of subquery


  • Works on Virtual tables
  • Is used with co-related queries
  • Exits comparison when match is found
  • Performance is comparatively FAST for larger resultset of subquery

4. What is Union and Union ALL

Union merges the contents of two structurally-compatible tables into a single combined table. The difference between Union and Union ALL is that Union will omit duplicate records whereas Union ALL will include duplicate records.

It is important to note that the performance of Union ALL will typically be better than Union , since Union requires the server to do the additional work of removing any duplicates. So, in cases where is is certain that there will not be any duplicates, or where having duplicates is not a problem, use of Union ALL would be recommended for performance reasons.

Social Media


All Posts

Contact Info