Section 1

Preview this deck

What are all the joins?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (8)

Section 1

(8 cards)

What are all the joins?

Front

Back

Stored procedure vs function

Front

You can call a function from a stored procedure but not a stored procedure from a function.

Back

What is the difference between union and join?

Front

Join you are consolidating column based, union is row based consolidation by records.

Back

What is difference between primary key vs unique key?

Front

Back

What is the difference between coalesce and isnull?

Front

Comparing COALESCE and ISNULL The ISNULL function and the COALESCE expression have a similar purpose but can behave differently. Because ISNULL is a function, it is evaluated only once. As described above, the input values for the COALESCE expression can be evaluated multiple times. Data type determination of the resulting expression is different. ISNULL uses the data type of the first parameter, COALESCE follows the CASE expression rules and returns the data type of value with the highest precedence. The NULLability of the result expression is different for ISNULL and COALESCE. The ISNULL return value is always considered NOT NULLable (assuming the return value is a non-nullable one) whereas COALESCE with non-null parameters is considered to be NULL. So the expressions ISNULL(NULL, 1) and COALESCE(NULL, 1) although equivalent have different nullability values. This makes a difference if you are using these expressions in computed columns, creating key constraints or making the return value of a scalar UDF deterministic so that it can be indexed as shown in the following example.

Back

If you have a query that you use a lot, do you use it in a function or a stored procedure?

Front

Function

Back

What is the difference between char and varchar?

Front

Varchar is of variable length and char is of fixed length. If you are not sure what is the length of specific columns you could use varchar and if you know what the column is then you could use char.

Back

Difference between ISNULL and Coalesce?

Front

Coalesce returns the first NULL If you have first name middle and last name and you put coalesce, if first name is null it will return middle name and if middle name is null then returns the last name.

Back