SQL Delete vs Truncate | SQL Delete Query | Delete and Truncate in SQL | SQL Truncate Query

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey guys welcome back to the Siskiyou tutorial series in this session we'll work with the delete and the truncate statements so the delete warius basically used to delete or remove one of our existing records in the table so let's have a look at the syntax well start with the delete keyword and then put in the key word from then we specify the name of a table after that we will specify the wire condition well that's optional now let's delete some records from our employee table so we have our employee table right here and I'd want to delete that record where the age of the employee is equal to 33 so this would be the command for that I will give in the delete keyword and then I'll type from and given the name of the table which would be employed after that I'll use the where clause and give the condition so the condition would be e H is equal to 33 I'll put in the semicolon over here and I'll hit execute so you see that one row has been affected now let me have a glance at the modified people so I will type in select star from employee execute again right so see that dot record where the age was equal to 33 has been removed so initially you had six records now we only have fire records in our table now similarly I don't delete that record where the imply name is equal to Sam so let me write the command slot so I will give in the delete keyword first and then I'll give in the from keyword after that I will give the name of the table employed then use the where clause and then give the condition so this time the condition would be e name is equal to Sam right execute again we have one roof which has been affected select star employee and let's see the modified table now so see that another record has been deleted and that record where the name was equal to Sam is the record which has been deleted then we have the truncate statement so the trunk a statement deletes all of the data inside the table so here will given the keywords truncate table and then get the name of the table so let me go ahead and remove all of the records from this employee table using the truncate command so I'll type cranky table and then I'll given the name of the table which is employing execute so see that commands completed successfully now I will type select start from I'm boy now let's see what do we get so we see that all of the records are empty this is because the truncate table command basically removes all of the data from the table and the specialty of the truncate command s even though it removes all of the records from the table the structure of the table remains intact so we see that the structure of this table over here employee table it is still intact but this is how we can work with a delete and front gate statements in the next session we'll learn about joins so thanks for attending this session let's meet in the next class
Info
Channel: Intellipaat
Views: 3,974
Rating: undefined out of 5
Keywords: SQL Delete Query, SQL Delete Command, SQL Truncate Query, SQL Delete vs Truncate, truncate vs delete, delete vs truncate, sql delete vs truncate, difference between truncate and delete, truncate table, delete and truncate, truncate command in sql, how to use truncate in sql, truncate table sql, truncate table mysql, truncate meaning in sql, truncate table sql server, how to truncate table, truncate example, truncate tutorial, truncate command
Id: 9FFyaPvJ4Fk
Channel Id: undefined
Length: 3min 30sec (210 seconds)
Published: Mon Jan 14 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.