WEBVTT 00:00.370 --> 00:01.330 You guys will come back. 00:01.350 --> 00:02.200 Now in this letter. 00:02.200 --> 00:06.690 We'll be talking about how to fetch data how to select data from our database. 00:07.140 --> 00:12.000 So we have stored these two values in our database that is sugar and Hershey. 00:12.030 --> 00:18.420 And if you want to fit this data and print on our command screen we want to show maybe on our counter 00:18.420 --> 00:23.840 application we want to show on our general website maybe we just want to print this result on our come 00:23.840 --> 00:25.140 online are dominant. 00:25.650 --> 00:29.460 So we need to know how to fetch data from our database. 00:29.460 --> 00:34.890 Before that I just want to tell you that you can use caution marked method that is instead of providing 00:34.890 --> 00:38.250 a parameter value you can directly use caution Mark. 00:38.460 --> 00:41.990 And then you can provide the values and a second entity. 00:42.000 --> 00:46.050 So this will help us to protect our database from a school injection. 00:46.080 --> 00:47.550 This is a recommended type. 00:47.880 --> 00:50.870 So now I just need to pass out my new value in Tampa. 00:51.000 --> 00:56.420 Now if I read this file in the previous year and I have changed the value of department ask fight on 00:56.430 --> 00:59.610 for my I.D. number two if I had even this file. 00:59.760 --> 01:03.030 It is going to change it as BHP that's done. 01:03.030 --> 01:04.920 Let me refresh my database. 01:05.070 --> 01:10.950 You can see I got my results BHP so I would recommend you to use these two entities method that would 01:10.950 --> 01:12.030 be much easier. 01:12.210 --> 01:14.600 As it is it is quite secure. 01:14.610 --> 01:20.070 Let me come in this one and let us talk about how to fetch our data from our database so to fetch our 01:20.070 --> 01:20.390 data. 01:20.400 --> 01:22.590 There are two steps that are in one. 01:22.590 --> 01:27.120 First we need to tell what type of data we require from which table. 01:27.330 --> 01:33.050 And then I need to use a command fetch all that will extract all the values of my requirement. 01:33.120 --> 01:36.720 So I just need to select the object and then the values. 01:36.720 --> 01:43.710 So just use my car or object then execute and then I need to pass select as strict or you can call it 01:43.710 --> 01:44.340 as a start. 01:44.640 --> 01:48.260 This means I need all the values from employees. 01:48.300 --> 01:50.240 So this is my table name. 01:50.280 --> 01:53.400 Now once that is done I need to use a command for John. 01:53.690 --> 01:56.350 So this will return me objects. 01:56.370 --> 02:00.420 So that means it would return all the objects that are stored in my database. 02:00.420 --> 02:02.190 So currently we have two objects. 02:02.220 --> 02:04.980 One is this one and the other one is this one. 02:04.980 --> 02:07.410 So it will store these two objects. 02:07.410 --> 02:09.870 Now I need to fetch data from these objects. 02:10.320 --> 02:13.970 So I would be taking a variable maybe a dessert. 02:14.070 --> 02:19.350 Now in this result I just need to use my cursor object and then fetch I'll come on. 02:19.350 --> 02:22.580 Now this result has all the data which I require. 02:23.010 --> 02:26.580 Now if I bring this result I will have all the values that I requested. 02:26.850 --> 02:32.840 So had I have given start that means I need all the values from my database for this particular table. 02:32.850 --> 02:39.970 So let me bring this one and if I had on my main not by you can see I got my boat. 02:39.970 --> 02:40.490 There is a. 02:40.960 --> 02:42.970 So the result is inside our list. 02:42.970 --> 02:49.920 So that means I can iterate using a for loop and then I can use in next position to catch them. 02:49.960 --> 02:57.020 So if I use a for loop I can easily trade to them and I can also select the values that we try to trade 02:57.030 --> 02:57.490 in them. 02:57.490 --> 03:00.740 So I just need to use for item in results. 03:01.030 --> 03:02.770 And I just need to bring the item 03:07.180 --> 03:14.260 here again to I got my two objects and if I just one name all of Ruiz use my first in next position 03:16.220 --> 03:18.480 you can see I got my perspective isn't. 03:18.590 --> 03:19.880 Now here is a twist. 03:19.880 --> 03:22.930 You can provide what column you require from database. 03:22.940 --> 03:24.910 Also you can provide a condition. 03:25.010 --> 03:25.980 So suppose head. 03:25.980 --> 03:26.930 We have a reserve. 03:27.320 --> 03:28.020 So I just want. 03:28.040 --> 03:34.100 Name of particular employer who are earning more than sixty thousand so I can employed this condition 03:34.220 --> 03:39.860 with my query and they will fetch that data as I had acquired so instead of this a start all you have 03:39.860 --> 03:43.040 to pass is name and head off your table. 03:43.040 --> 03:50.790 You just need to pass out the condition so I can use their salary is greater than sixty thousand. 03:50.930 --> 03:51.820 This looks fine. 03:51.860 --> 03:58.030 Let me print out my result. 03:58.260 --> 04:01.630 You can say I got a couple as a result and here I have shown them. 04:02.020 --> 04:08.040 And if I print out just the result you will get this answer in a list and then inside that you will 04:08.040 --> 04:08.790 have a couple. 04:09.330 --> 04:11.160 So that's our school query will. 04:11.550 --> 04:15.660 Now you know how to select columns and how to pass out to condition. 04:15.660 --> 04:22.710 So suppose I need name as well as salary of the employer whose department is spied on. 04:22.710 --> 04:26.760 So all I have to do is use name and I also require salary. 04:26.760 --> 04:32.400 These two columns are required by me and then I need to pass out my condition here the condition is 04:32.460 --> 04:34.980 the department should be equals to bite on 04:38.520 --> 04:39.530 let me pin this on. 04:40.970 --> 04:42.440 Hey you can see I got the result. 04:42.570 --> 04:45.450 That is Sharon and seventy five thousand. 04:45.450 --> 04:51.320 So this is our Skrill query to select data and fetch you to work and I hope you understand about it. 04:51.450 --> 04:55.250 Don't worry we are going to cover everything in our content application as well. 04:55.290 --> 05:00.720 So this is just a basic stuff that you should know and you should be familiar with that in the next 05:00.720 --> 05:04.650 lecture let us talk about how to delete any value from our database.