Wednesday, 14 October 2015

Some Interview Question about SQL Table



interviewer created Four table

1. EmployeeDetails
2. CityDetails
3. JobDetails
4. Employee


1. EmployeeDetails
Id Firstname Lastname CityId Jobid



2. CityDetails
Id CityName

3. JobDetails
Id Job

4. Employee
Id Firstname Lastname CityName Job

Now the time of question on these two table :-)

Q1. I want all Details of Employee. how can i get the result ??
Ans: From these above three table i will use join and from forth table i will use select Query

Q2. Which Query will give fast Result?
Ans: Select * from Employee will Give Fast result.

Q3. Why??
Ans: because in first scenario we will use join it will take time.

Q4. Above three Table is normalized right?
Ans: Yes

Q5. Then what is the need of normalization if it will take time for fetching records??
Ans: advantage of Normalization is it will remove Repetitive value. for Example in 4th table job and city will be repeat again and again. it will take server space.

Q6. Ok...my client not worry about space...he can purchase more space for Storage then...why we need normalization?? my client want page performance...then he should to use single table??


No comments:

Post a Comment