WEBVTT 00:00.620 --> 00:01.190 Welcome back. 00:01.250 --> 00:05.840 Now in this lecture let us talk about how to delete anything from our database. 00:05.840 --> 00:10.350 So in the previous lecture we talked about how to fetch our data and you might have noticed that I have 00:10.370 --> 00:12.260 removed the committee's statement. 00:12.260 --> 00:12.900 Why. 00:12.920 --> 00:17.060 Because we are not changing anything in our database while fetching data. 00:17.120 --> 00:23.530 I'm just taking data from my database and displaying out our result but I'm not changing anything in 00:23.540 --> 00:24.710 my database. 00:24.710 --> 00:30.350 So whenever we change anything in our database whenever we modify anything on our database we use coming. 00:30.800 --> 00:35.630 If you're not modifying anything if you are extracting or fetching data you don't have to comment. 00:36.020 --> 00:40.190 So let me come into these called. 00:40.410 --> 00:47.230 Now I have two cases for delete either delete everything in our database that is delete all and the 00:47.220 --> 00:50.400 second cases I just need to delete a specific result. 00:50.820 --> 00:53.810 So just imagine there are thousands of results in our database. 00:53.820 --> 00:59.280 And if you want to delete any specific result you have to use the same method that we are using for 00:59.400 --> 01:02.830 inserting or fetching and for updating. 01:02.830 --> 01:08.580 So let me add five six more reserved in my database so you can understand delete in other than minor 01:09.360 --> 01:10.150 changes done. 01:10.170 --> 01:14.350 So I've added three more result in my database liquid first this one. 01:14.350 --> 01:20.550 Hey you can see now I have five frozen what I need to do is I just need to run a simple query to delete 01:20.580 --> 01:27.120 this fourth result maybe so I would be using my cursor object then execute then I need to pass a query 01:27.120 --> 01:34.470 called delete from my table name there I just need to pass out a particular condition so that row would 01:34.470 --> 01:35.190 be deleted 01:37.850 --> 01:43.610 remember heavier modifying our database as we are changing or removing of value from our database. 01:43.730 --> 01:45.710 So I need to commit out my result. 01:46.310 --> 01:46.880 That's done. 01:46.880 --> 01:47.830 Let me run this one 01:52.310 --> 01:54.080 fresh out my database. 01:54.280 --> 01:55.720 You can see both the fields are gone. 01:55.720 --> 02:02.320 That is my fourth and fifth because both the user named Shane and her if you want to talk about how 02:02.320 --> 02:08.800 to delete everything from our database so all I have to do is don't pass any condition that will solve 02:08.800 --> 02:09.520 our problems. 02:09.520 --> 02:11.590 That means DELETE FROM employee. 02:11.620 --> 02:15.030 So it will delete everything from our database. 02:15.070 --> 02:21.700 Let me run this one and if I refresh my database here you would see there is no reason. 02:22.120 --> 02:25.230 So that's how we delete everything from our database. 02:25.270 --> 02:30.730 And if you have any specific time that you want to delete that is a specific result with the condition 02:30.970 --> 02:31.840 you can use that. 02:32.680 --> 02:34.180 I hope this lecture was helpful. 02:34.300 --> 02:37.580 So in the next lecture we are going to do a bit of interesting task. 02:37.600 --> 02:43.380 We are going to create a function to insert to delete to update and also to fetch our data. 02:43.590 --> 02:47.420 So that would help us to shape our functionality regarding database. 02:47.440 --> 02:53.130 So even if you are working with counter application in future you can create a function for insert. 02:53.170 --> 02:57.780 So whenever you want to insert any Come on you don't have to repeat these lines of code. 02:58.060 --> 03:03.920 All you have to do is just pass out the barometer and not insert value that is not insert function. 03:04.060 --> 03:06.070 And it will do everything by its own. 03:06.640 --> 03:07.860 So see you in the next one. 03:07.870 --> 03:10.030 And let us complete our database activity.