I work on sql server 2017
i need to delete all rows from table student_course
but i don't know use
delete from student_course
or
truncate table student_course
table student_course
studentid pk
courseid pk
table student table
studentid pk
table courses
courseid pk
---------------------------------------------
student_course table have relation with courses table and student table
so which command will be used to delete all rows from table student_course
truncate or delete ?

Uttam KumarRank #1,076 · 1.8K reputationPosted Apr 28, 2022, 4:34 AM EDT
You can use either one delete or truncate. Both will delete all the data from the table.
Delete from student_course Truncate table student_courseUpon deletion using Delete command will only delete all the data where as using Truncate command will not only delete all the data but reset the table to initial state.
Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Apr 27, 2022, 2:35 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 28, 2022, 1:39 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Aug 28, 2022, 3:51 AM EDT