SQL - Interview Questions and Answers

Q1.  Difference between Inner and Outer Join ?

Ans. Inner join is the intersection of two tables on a particular columns whereas Outer Join is the Union of two tables.<br /><br /><br /><br />

Q2.  What is a Cursor ?

Ans. It's a facility that allows traversal over the records pulled from a table or combination of tables. Its like iterator in Java.

Q3.  What are temp tables ?

Ans. These are the tables that are created temporarily and are deleted once the Stored Procedure is complete. <br /><br />For example - we may like to pull some info from a table and then do some operations on that data and then store the output in final output table. We can store the intermediary values in a temp table and once we have final output with us, we can just delete it.

Q4.  Does SQL allow null values ? Can we use it within Where clause ?

Ans. Yes , we can have null values for columns in SQL. Null value represent that the columns value is unknown or haven't been filled. Yes, We can use it within where clause to get the rows with null values.

Q5. The act of joining one table with itself is called ?

Ans. Self Join

Q6. Which method is used for getting current Date ?

Ans. GetDate()

Q7. Which wild cards are used for pattern matching in SQL ?

Ans. % for multi character and ? for single character