What is the difference between Delete, Truncate and Drop commands?

Поделиться
HTML-код
  • Опубликовано: 11 июл 2022
  • 1. Full .NET Interview Course
    C# / ASP.NET Core / MVC / API - Top 500 Interview Questions
    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% Discount 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.

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

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

    One more difference.
    TRUNCATE command reset the identity to its seed value. But DELETE retains the identity and does not reset it to the seed value.

  • @kathiranbuu5786
    @kathiranbuu5786 7 месяцев назад +1

    If you use the truncate command data cannot be rollback.
    Truncate is a DDL command , it's autocommit.

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

    Hello sir, I got selected in IBM-Pune by watching and practicing through your interview videos. Thank you so much.

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

      Glad my videos helped you cracking interview. Congratulations @saroshfaisalkhan3531. All the very best ;-)

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

      @@interviewhappy Thank you so much Happy Sir... stay happy and healthy..and lots of love for you.

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

    Hi Happy...I have one query, if we write Truncate and Drop statements in transaction. Can it be rollbacked?

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

    Truncate can not Rollback
    Rollback operation we can not perfrom in Truncate
    Because Truncate is AutoCommit

  • @KushKumar-ig9ub
    @KushKumar-ig9ub 2 года назад +1

    If we write Command "Delete from Table_name;" Or "Drop Table Table_name;" Then what will be the difference and which one to prefer and why?

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

      Hi Kush, if you write delete then the whole data/ records will be deleted but the table structure will remain there. You can write insert command to put data back. But if you drop then table structure will be gone also. You have to recreate the table again and then insert data there.

    • @KushKumar-ig9ub
      @KushKumar-ig9ub 2 года назад

      @@interviewhappy soryy i meant Truncate table Table_name
      This query and delete

    • @KushKumar-ig9ub
      @KushKumar-ig9ub 2 года назад

      I mean difference between delete and truncate command without where clause in delete command

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

      @@KushKumar-ig9ub without where only two differences. Truncate can't be rollbacked. You run it and all data is gone. Delete can be rollbacked. Truncates is fast and its a DDL. Delete is slow and DML. It is recommended to use delete.

    • @sreedharreddy205
      @sreedharreddy205 5 месяцев назад

      @interviewhappy but in the video you mentioned truncate also can be rollback .