Wednesday, March 24, 2010

SQL InterviewQuestions-Part4

31) What is the difference between stored procedure and a trigger?
a. Storedprocedure
1. We should call it explicitly
2. They can't be inactive
Trigger
1. They can be called automatically inplace of or after (data modifications) triggering actions like Insert, delete or update
2. Thay can be inactive


32) What is normalization?
a. It is a process of organizing data efficiently in database.

33) Advantages of normalization?
a. 1. It reduces redundant data
2. Ensures that data dependencies make sense

34) Why we use join?
a. Joins are used to query data from two or more tables, based on a relationship between certain columns in these tables

35) Types of joins?
a. 1. Join: Returns rows which have match in both the tables
2. Left Join: Returns rows which have match and the rows from the left table which have no match for them in right table
3. Right Join: Returns rows which have match and the rows from the right table which have no match for them in left table
4. Full Join : Returns rows when there is a match in one of the tables

36) why we use Rollback statement?
a. It cancels the proposed changes in a pending database transaction

37) why we use Check constraint?
a. It is used to limit the value range that can be placed in a column

38) why we use NOW() function?
a. It returns the current system date and time

39) What is a subquery?
a. A subquery is a query that appears with in another SQL data manipulation statement

40) Why we use DATEPART() function?
a. It Returns a single part of a date/time

No comments: