Top 25 SQL Server Interview Questions - .NET C#

Поделиться
HTML-код
  • Опубликовано: 13 июл 2024
  • 1. Full .NET Interview Course (with PDF Book)
    C# / ASP.NET Core / MVC / API - Top 500 Interview Questions
    Coupon code DOTNETOFFERJUN2024 applied in below URL- 80% Off - Limited Time Offer
    www.udemy.com/course/csharp-o...
    Don't worry if course not helping you, Udemy has 30 days Free Refund Policy.
    2. Quick Revision Book (PDF format)
    Top 500 .NET Interview Questions - OOPS/ C#/ ASP .NET/ MVC/ SQL /.NET Core /Web API
    imojo.in/interviewhappy
    50% Off - Limited Time Offer Applied on above link.
    Don't worry if book not helping you, I will return 100% of your money with in 7 days of purchase. Just mail me at anuragrawat123@gmail.com.
    My best wishes are with you.
    This video contains the top 25 interview questions asked from SQL Server topic:
    00:00 - Introduction
    00.56 - Q1. What is the difference between DBMS and RDBMS?
    02:23 - Q2. What is a Constraint is SQL? What are its types.
    06:45 - Q3. What is the difference between Primary key and Unique key?
    08:36 - Q4. What are Triggers and types of triggers?
    13:34 - Q5. What is a View?
    16:58 - Q6. What is the difference between Having clause and Where clause?
    18:23 - Q7. What is Sub query or Nested query or Inner query in SQL?
    19:27 - Q8. What is Auto Increment/ Identity column in SQL Server?
    21:12 - Q9. What are Joins in SQL?
    21:49 - Q10. What are the types of Joins in SQL Server?
    24:23 - Q11. What is Self-Join?
    27:06 - Q12. Write a SQL query to fetch all the Employees who are also Managers.
    30:22 - Q13. What are Indexes in SQL Server?
    31:18 - Q14. What is Clustered index?
    33:10 - Q15. What is Non-Clustered index?
    34:53 - Q16. What is the difference between Clustered and Non-Clustered index?
    36:49 - Q17. How to create Clustered and Non-Clustered index in a table?
    38:00 - Q18. In which column you will apply the indexing to optimize this query. “select id, class from student where name=”happy””?
    39:47 - Q19. What is the difference between Stored Procedure and Functions (at least 3)?
    43:30 - Q20. How to optimize a Stored Procedure or SQL Query?
    47:12 - Q21. What is a Cursor? Why to avoid them?
    49:40 - Q22. What is the difference between scope_identity and @@identity?
    51:46 - Q23. What is CTE in SQL Server?
    53:41 - Q24. What is the difference between Delete, Truncate and Drop commands?
    57:36 - Q25. How to get the Nth highest salary of an employee?
    01:00:49 - (Bonus Question) What are ACID properties?
    01:03:07 - (Bonus Question) What are Magic Tables in SQL Server?

Комментарии • 93

  • @soop9392
    @soop9392 3 месяца назад

    Need interviewer like you who knows logic is magic. some interviewer patterns makes us to loose confidence who expect bookish answers

  • @aditijain70
    @aditijain70 Год назад +4

    Great Explanation!
    I gave an interview just a few days back and all the questions were explained here except for one or two.
    Thank you!

  • @pallavipawankar9705
    @pallavipawankar9705 2 года назад +7

    This is a great video for interview purpose. Thanks a lot!

    • @interviewhappy
      @interviewhappy  2 года назад

      wc Pallavi.. and thanks for your comment

  • @kesavanmechanical
    @kesavanmechanical Год назад +4

    Very information and useful for my SQL interviews. Thanks Happy.

    • @interviewhappy
      @interviewhappy  Год назад

      That is my objective Kesavan, all the best for your interviews.

  • @markippo
    @markippo 11 месяцев назад +3

    Couple things that catched my eyes. 1) Primary Key always creates a clustered index - no, only if CI dosen't exist, if it does nonclustered unique is created.
    2) clustered is faster than nonclustered - it depends on what we're doing. If we searching only for indexed columns or non indexed are included into nonclustered index - they will be performing the same or nonclustered will be faster... Overhead is only when nonclustered index needs take rest of the data from a heap or clustered index...
    3) Cross join is also part of sql server logical joins (in documentation at least). Logical joins are a wage topic. Some people will also include any operation that is based on physical joins so semi joins, set operations (union, intersect, except, concatenation as union all), aggregates are also included.
    4) Self Joins... Oracle people talk a lot about it... I've never heard this phrase in a sql server community...
    5) Drop table could be also rolled back in sql server. Answer to this question: Dml VS ddl. Operation on data itself vs definition of the data. Dml are fully logged, ddl minimal...
    6) Nth salary... Order by clause is not allowed in derived tables (subqueries). What if more than one person has the same salary? Use dense_rank
    7) Consistency stands for capability of rdbms to be consistent apart from transaction result. So if transaction passes - save the data, if not or was hanged - roll itself back to the former state... It is quite obvious when everything's fine but it's really crucial after server crush... After reboot consistency of every db is checked... It has 3 phases - Analysis (what needs to be committed, what needs to be rolled back) Redo - store committed but not saved transactions. Undo - rollback uncomited transactions that were saved (it's called "dirty pages) - it happens when server operates under memory pressure - data are stored despite they're not committed...
    7) Improving performance: 1) look at obvious issues with your query/procedure. Do some stuff. It if helped - you're good to go, if not 2) look at estimated execution plan - apply some indexes etc. 3) look at real execution plan - check if your sp is not victim of parameters sniffing etc.
    8) memory consumption isn't so important with cursors... Thier iterative nature is... They're terribly slow compered to set/batch operations. That's why never use cursors unless you need to.

  • @ARMLifeExpressions
    @ARMLifeExpressions 9 месяцев назад +1

    Though i am familiar with SQL server quite few years, still lot of points to learn with your video, really nice content. thanks.!

    • @interviewhappy
      @interviewhappy  9 месяцев назад

      Great to hear! Thanks @Arm_luckyno23

  • @balajirk4572
    @balajirk4572 2 года назад +1

    Thank you so much

  • @rasikasamith
    @rasikasamith Год назад +2

    Thank you a lot for the effort to make this valuable video. Keep it up.

    • @interviewhappy
      @interviewhappy  Год назад

      wc and Thanks Rasika. Wish you all the best for your career.

  • @Manithan123
    @Manithan123 Год назад +4

    Great video. Thanks for sharing! There is a minor correction in the video on Delete vs Truncate. While the Delete can be rolled back Truncate can't be rolled back. The video incorrectly mentions that both can be rolled back.

  • @vidhyadharmote2989
    @vidhyadharmote2989 Год назад +3

    Seriously..you have explained very nicely, it's very useful 😊 thank you !

    • @interviewhappy
      @interviewhappy  Год назад

      Your Welcome . Glad you liked it Vidhyadhar.

  • @fahimakhtar6926
    @fahimakhtar6926 Год назад +3

    great knowledge for interview . ❤❤

    • @interviewhappy
      @interviewhappy  Год назад

      Thanks Fahim. Wish you all the best for your career.

  • @SatinderSingh-cp6hn
    @SatinderSingh-cp6hn Год назад +1

    Again very nice collection and well explained.. 😇😇

  • @jyothip1629
    @jyothip1629 Год назад +2

    Hi Sir, Thank you so much for these wonderful videos.
    Could you please make a video on How To Return A Value From A Stored Procedure in Sql Server.

    • @interviewhappy
      @interviewhappy  Год назад +2

      Hi Jyothi, use out parameters is the answer.

  • @ankitbisht3794
    @ankitbisht3794 Год назад +1

    I think unique key cols can have multiple null values?

  • @rathika.m2362
    @rathika.m2362 Год назад +3

    Can you please do Video for Azure.. Your videos are really useful for us.. Thank you for your effort

  • @amrutapatil2251
    @amrutapatil2251 Год назад +1

    Thank you so much sir

  • @jamunadevi7635
    @jamunadevi7635 2 года назад +5

    Thanks sir..coming Saturday I have interview ..I am watching your videos and preparing . I can easily understand your explanation

    • @interviewhappy
      @interviewhappy  2 года назад +1

      Thanks Jamuna, best of luck, if you know any answer try to elaborate it as much as possible.

    • @veerabhadrarao258
      @veerabhadrarao258 2 года назад +1

      @@interviewhappy how to reach u brother 🙂

    • @interviewhappy
      @interviewhappy  2 года назад

      @@veerabhadrarao258 whatever queries you have regarding interviews - careers.. just post it here and we can discuss.

    • @veerabhadrarao258
      @veerabhadrarao258 2 года назад

      @@interviewhappy i need personal support frm you

    • @interviewhappy
      @interviewhappy  2 года назад

      @@veerabhadrarao258 this is my email id anuragrawat123@gmail.com. We can discuss on email.

  • @totoro3439
    @totoro3439 Год назад +3

    Sir can you do normalisation video with practical examples ? Thank you

  • @ramuvunnam7661
    @ramuvunnam7661 11 месяцев назад +2

    super bro

    • @interviewhappy
      @interviewhappy  11 месяцев назад

      Thanks bro. All the best for your career.

  • @funandfood_hyderabad
    @funandfood_hyderabad 20 дней назад

    Thank you 😊

  • @satishdan
    @satishdan Год назад +7

    Hello you said Truncate can be rollback, but actually Truncate cannot be rollback. By the way excellent video and appreciate your efforts

    • @sandeepbhandigare3589
      @sandeepbhandigare3589 Год назад

      Truncate can be rolled back. You might be referring DROP command

    • @sayujyakasekar3852
      @sayujyakasekar3852 Год назад

      Check in SQL server it can be rollback

    • @ashleygahl3638
      @ashleygahl3638 Год назад +1

      Truncation can rolled back if used inside a transaction

    • @Mr.Ash-cz9rf
      @Mr.Ash-cz9rf Год назад

      Most of the places it's showing truncate can't be rollback.

  • @mageking4343
    @mageking4343 2 года назад +1

    thanks sir

  • @duo_the_explorer
    @duo_the_explorer Месяц назад

    Awesome video sir

  • @adilkevin6220
    @adilkevin6220 Год назад +2

    What to do if the auto-increment value reaches its limit?. Considering that it's a banking application I don't want to delete the older data how are you going to resolve the issue?

    • @interviewhappy
      @interviewhappy  Год назад

      Now a days GUID are used for ID's. That will never let that problem happen.

  • @vigneshvk4940
    @vigneshvk4940 11 месяцев назад +1

    Can you please create a video about C# design pattern interview questions

    • @interviewhappy
      @interviewhappy  11 месяцев назад

      Yes vignesh soon will update . Stay connected

  • @bhargavisunchu6500
    @bhargavisunchu6500 Год назад +1

    Can you do video on .Net core please. nice videos

    • @interviewhappy
      @interviewhappy  Год назад

      Thanks Bhargavi. I already created videos on .NET Core also. You can check in my channel.

  • @harshanaini1509
    @harshanaini1509 4 месяца назад

    very helpful vidoe

  • @anzilkk8427
    @anzilkk8427 Месяц назад

    ♥️👍

  • @kansaascollection
    @kansaascollection 4 месяца назад

    Difference between table variable and cte

  • @user-yz5kz4ey3v
    @user-yz5kz4ey3v 10 месяцев назад +1

    SIr please make video on user defined function and its types

    • @interviewhappy
      @interviewhappy  10 месяцев назад +1

      Sure I will try to cover that in future.

  • @kevinwtao5321
    @kevinwtao5321 Год назад +1

    Hi,Mr.: All are perfect, however, Q24for '"Truncate rollback " seems like "not rollback"

    • @interviewhappy
      @interviewhappy  Год назад

      Thanks Kevin, I will cross check that question.

  • @sonaldeshbhaket6698
    @sonaldeshbhaket6698 11 месяцев назад +1

    Your book has kindle addition only . I want paperback book of interview questions. Please tell me how can i get the book.

    • @interviewhappy
      @interviewhappy  11 месяцев назад

      Sorry Sonal, the paperback is not available right now. May be in future. All the best for your career.

  • @gkmishra2009
    @gkmishra2009 Год назад

    please make video on azure interview

  • @Dot-Net_Dev
    @Dot-Net_Dev Год назад +2

    Logic is tha Magic

  • @nomikhan2646
    @nomikhan2646 Год назад +2

    we use insert update delete in the sp and cannot in the function this point is wrong broh in your video

  • @chathurangawickramasinghe9727
    @chathurangawickramasinghe9727 Год назад +1

    TRUNCATE reset the auto increment IDs but DELETE not

  • @adilkevin6220
    @adilkevin6220 Год назад

    There was one question why we are using cursor instead of a while loop?

    • @interviewhappy
      @interviewhappy  Год назад

      In 90% cases we can replaced cursor with loops and that is recommended because cursor is performance heavy. I just wanted to explain cursor, that's why :)

    • @adilkevin6220
      @adilkevin6220 Год назад

      @@interviewhappy I was asked this question in the interview? Why cursor when we can use while loop. What should be the answer for this question ?

  • @FunAndCreativeCorner
    @FunAndCreativeCorner Год назад +1

    Shared one email regarding interview questions I faced last week sir. Please give reply.

  • @poojaswain4722
    @poojaswain4722 2 года назад +1

    Sir practical kar k dikha dete to or bhi achha hota

    • @interviewhappy
      @interviewhappy  2 года назад

      Noted Pooja.. next time

    • @poojaswain4722
      @poojaswain4722 2 года назад

      Thank you sir

    • @poojaswain4722
      @poojaswain4722 2 года назад +1

      Sir normalization ka ek video bana dijiye interview me bahut baar puchh chhuke hai

    • @interviewhappy
      @interviewhappy  2 года назад +1

      @@poojaswain4722 sure this is related with the design of tables in database. Right now I am creating something in Angular but will cover this soon.

    • @poojaswain4722
      @poojaswain4722 2 года назад

      Okk sir

  • @pallavipawankar9705
    @pallavipawankar9705 2 года назад +2

    What is Normalization in SQL?

    • @interviewhappy
      @interviewhappy  2 года назад +3

      When you create your application database tables from scratch, then you have to follow some rules - 1NF, 2NF, 3NF, BCNF...
      If you will not follow these rule, then later when data is filled in those tables.. you will face difficulty in managing that data.

  • @abhishekjamwal6781
    @abhishekjamwal6781 3 месяца назад

    Thank you so much sir