Ques 1. What is the processing order of different clauses in a SQL query?
Ques 2. When do you use WHERE clause and when do you use HAVING clauses?
The WHERE clause is evaluated before rows are grouped, and therefore is evaluated per row. The HAVING clause is evaluated after rows are grouped, and therefore is evaluated per group. An aggregate function cannot be used with where clause, so use HAVING when you have to use an aggregate function.
Ques 3. HOW COALESCE and ISNULL differs?
ISNULL takes only 2 arguments whereas COALESCE can table multiple values as argument.
Select COALESCE(null,'LONDON',NULL),ISNULL(null,'AnotherValue'), NULLIF('a',NULL)
Ques 4. if you declare a variable as varchar datatype without specifying the length, what length it will take?
Ques 5. When should you use varchar and when should you use char data type?
When you know that a particualr column will always have a fixed length data e.g. Airline Code, use CHAR.When length is not fixed, use varchar.