Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

SQL Server Interview Questions and Answers

Part 1 - How to find nth highest salary in sql | Sildes
Part 2 - SQL query to get organization hierarchy | Slides
Part 3 - How does a recursive CTE work | Slides
Part 4 - Delete duplicate rows in SQL | Slides
Part 5 - SQL query to find employees hired in last n months | Slides
Part 6 - Transform rows into columns in sql server | Slides
Part 7 - SQL query to find rows that contain only numerical data | Slides
Part 8 - SQL Query to find department with highest number of employees | Slides
Part 9 - Difference between inner join and left join | Slides
Part 10 - Join 3 tables in sql server | Slides

Part 11 - Real time example for right join | Slides
Part 12 - Can we join two tables without primary foreign key relation | Slides
Part 13 - Difference between blocking and deadlocking | Slides
Part 14 - Sql query to select all names that start with a given letter without like operator | Slides
Part 15 - SQL script to insert into many to many table | Slides


  1. thanks for giving sql interview questions....sir can u upload more interview may help to all of us....

  2. Hello sir i have a question that if i have a table called
    tblemployee with Id,Name,Age,Salary as column and Id is
    primary key if i will write select * from tblemployee
    where age=some value that is present in age column and only primary key is there on Id column so here clustered index will work or not if yes then how bcaz index is on Id

  3. No it will not work as clustered index.

  4. Hello sir thanks for giving interview questions....can u upload about "What is Sql tuning and how to achieve it ?"

  5. Hi Sir,

    I have a question.

    If I have a sequence in where clause , how can I fetch data order by data in where clause and null for non matching data.

    e.g : select * from resources where n_res_id in (4,5,6,2,1)

    Expected result :

    id name
    4 Abc
    5 Asd
    6 null
    2 xyx
    1 null

    1. if you are retrieving selected ids from table:
      string str="";
      //use datareader :

      string id=dr["id"].tostr();

      pass this str to your query.

  6. Hi Hope you can make a video on how to Distribute an amortization schedule for a loan based on schedule like Monday, Wdnesday Friday (MWF) and Tuesday, Thursday and Saturday (TTHS) payment schedule for a specified number of days or months.

  7. please help in using variables used in stored procedure i m very confused using variables how they hold values .

  8. Hell Sir ,
    I need your help in sql server 2008, will you please send me important topic which always ask in interview regarding SQL Server 2008 for one yr experience.

  9. Hi Sir
    I have a question, Please help with query separed columns multivalue in new columns in the same register. I uses SQL server 2008.

    nombre perfil
    karina 1,2,4,5,10,109
    mark 2,3,45,10,11
    Juan 109

    Expected result
    nombre perfil perfil1 perfil2 perfil3 perfil4 perfil5
    karina 1,2,4,5,10,109 1 2 4 5 10
    mark 2,3,45,10,11 2 3 45 10 11
    Juan 109 109


  10. Hi Sir

    I was asked in a recent interview if we can create multiple indices on a tablet E.g. A clustered index on heap and then create a primary key so we have 2 clustered indices.

    Is it possible? Can you explain it with a demo video like you always do.

    Thank you in advance.

  11. Hi Sir,

    I had one interview question which was asked me twice.
    Design a application with SQL database, where database can be replaced by Oracle with minimum changes. is it possible

  12. Hello Sir,
    In the recent interview, I was asked
    -the storage details of how record is fetched from partitioned table.
    -how to determine the execution cost of join query, what are the different execution plans are being made.

  13. Hi.. Sir
    I have two tables

    ID Unit Convertion
    1 P 1
    1 S 10
    1 D 100

    ID Value
    1 523

    I want join table1 and table2 then result like this

    Unit Convertion NewValue
    D 100 5 523/100 = 5
    S 10 2 523 - (5 * 100) = 23/10 = 2
    P 1 3 523 - (5 * 100) - (2 * 10) = 3/1 = 3


It would be great if you can help share these free resources