/    /  SQL- Interview questions Part 7

1. What is Self-Join?

Answer: Self-join is set to be query used to compare to itself. Self-join is used to compare values in a column with other values in the same column in the same table. ALIAS ES can be used for the same table comparison.

 

2. What is Cross-Join?

Answer: Cross join defines as Cartesian product where number of rows in the first table multiplied by number of rows in the second table. For example, WHERE clause is used in cross join then the query will work like an INNER JOIN.

 

3. What is user defined functions?

Answer: User defined functions are the functions written to use that logic whenever required. These functions are not necessary to write the same logic several times. Alternatively, function can be called or executed whenever needed.

 

4. Explain types of user defined functions?

Answer: Three types of user defined functions are.

1.Scalar Functions.

2. Inline Table valued functions.

3. Multi statement valued functions.

4. Scalar returns unit, variant defined the return clause. Other two types return table as a return.

 

5. What is collation?

Answer: Collation is defined as set of rules that determine how character data can be sorted and compared. Collation can be used to compare A and, other language characters and also depends on the width of the characters. Character data is be used to compare ASCII value.