I have studied some topics on .NET and SQL Server for interview prospective.
Interviewer started the interview with the question of total year of experience.
Then he asked me have you worked on SQL Server, I said yes !
He took one paper and told me that there is one table Emp having columns name, salary and dateOfBirth.
Firstly he asked find out the all employees form Emp table whose age is more than 27 years.
I tried it for few mins but no answer.
Then he asked me who is having the 18th maximum salary form all the employee .....and again i have no answer.
Finally he asked me find out the employees who having the same name in the company..... no answer again.
I was thinking what will he ask now ......
And he switched form SQL Server to .NET ........
What is 3 tire architecture ? I explained him in detail.
Then he asked me what are the control available in ASP.NET and i answered with two main category of ASP.NET rather than listing all the controls.
After two good answers he again switched to SQL Server with the question of view.
What is view and what are the types of view, I don't know what happened but I couldn't able to answer that question.
And i was just waiting when he will finish the interview as I am not able to give any answer on sql server.
He finally told that thanks Avinash we will get back to you.
Thats it ! I feel bad for some time ............
But that was good experience for me and one good trigger for starting the study of SQL Server in details.
So if you are planning to give any interview be ready for all above questions, specially for the small companies as they wann all skills in employee.
I got answers
ReplyDelete1. Select Name From Emp
Where Datediff(year,DOF,getdate()) >= 27
2. SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP 6 salary
FROM employee
ORDER BY salary DESC) a
ORDER BY salary
Hello Avinash,
ReplyDeletehttp://amolpatil-developer.blogspot.com/2010/08/finding-nth-minmax-salary-using-sql.html
Please try this following sql statement
To find Nth maximum salary:
1.In SQL Server 2005
SELECT * FROM (SELECT salary,Dense_rank() OVER (ORDER BY Salary desc) AS Rank FROM employees) t1 WHERE Rank=N
2.In SQL Server 2000/2005
SELECT salary FROM employees e1 WHERE (N = (SELECT COUNT(DISTINCT (e2.salary))
FROM employees e2 WHERE e2.salary >= e1.salary))