WEBVTT 00:00.560 --> 00:06.680 Hi guys in the last tutorial we were discussing about the connection to my database. 00:06.920 --> 00:14.680 So as we have run that example with Gore the message that connected to my S-K database. 00:14.940 --> 00:17.760 Now today we are going to create a table. 00:18.090 --> 00:21.140 Let's create a new python file. 00:21.690 --> 00:32.900 We will create a new python file here and give it name as might be one dog's By be wise. 00:32.910 --> 00:34.230 Stand for Python. 00:34.380 --> 00:41.430 So what we are going to do is we are going to create a connection with a skill light and after that 00:41.430 --> 00:47.230 we are going to create a table and we are going to insert the values in that table. 00:47.490 --> 00:52.790 So let's begin with import state mine as you like. 00:52.910 --> 00:54.450 CLE as you like. 00:54.450 --> 00:58.180 Three is a package which we have already installed. 00:59.510 --> 01:08.180 In this particular ID that is by Tom now in the last tutorial we have discussed about how to import 01:08.180 --> 01:11.410 the packet in the might job. 01:11.570 --> 01:20.600 So if you want to see that how to import the package of Mistral or rescue like you can there for the 01:20.600 --> 01:24.300 previous Territorials let's begin with this. 01:24.440 --> 01:26.710 I'm importing the SU like tree. 01:26.840 --> 01:35.750 Now what we are going to do is first we are going to create our database if not exist. 01:37.060 --> 01:38.940 The database does not exist. 01:38.950 --> 01:52.970 We are going to create it and we are going to get that connection also with that database not for that 01:53.090 --> 02:03.110 but we need to do is we will create a variable here named as connection and that connection is as few 02:03.110 --> 02:11.060 like three dog connect statement we will use and inside the connect function we will pause the pattern 02:11.060 --> 02:13.580 that tells us we will pass. 02:13.590 --> 02:19.310 Here's the location where I've worn those stole my database. 02:19.310 --> 02:28.160 So here I will write the location where I want to store my database so I will provide the location here. 02:28.370 --> 02:39.190 I will provide equal softwares equal and softwares and inside them I have all day before forwarder inside 02:39.230 --> 02:42.780 the day before the I want to create my table. 02:43.100 --> 02:47.690 Let's say I warn student darte database. 02:47.960 --> 02:56.960 So I want to create this database inside the Esau's first database and after that what we are going 02:56.960 --> 03:01.260 to do is we have curso statements. 03:01.330 --> 03:04.720 As you all know that curso statements are there. 03:04.780 --> 03:12.220 We are having a linker so we are having different kind of concert so we will what we are going to do 03:12.230 --> 03:16.890 here is we will get the cursor here and there. 03:16.960 --> 03:17.730 Good answer. 03:17.830 --> 03:26.080 We are going to add Ziegel the still statements we are getting but we are going to do is we are going 03:26.080 --> 03:31.580 to execute Asgill statements with the help of course. 03:31.900 --> 03:41.060 So for that I will create a variable here named this cursor and for that cursor I'm going to use the 03:41.060 --> 03:47.910 connection object and with the use of connection object I'm going to use here the cursor function. 03:47.970 --> 03:55.960 Now all we have done we have created a connection and we have created a cursor here to execute this 03:55.970 --> 03:57.380 girl statements. 03:57.500 --> 04:05.520 Now Octodad we are going to create a table here create table for create that table. 04:05.530 --> 04:12.430 I'm going to create a new variable name does that skew well inside as well. 04:12.430 --> 04:15.460 I'm going to use is for that. 04:15.520 --> 04:17.630 I need to create a query here. 04:17.710 --> 04:19.630 I am going to create a table. 04:19.870 --> 04:23.420 So I'm going to use or create query here. 04:23.920 --> 04:24.900 Create table. 04:24.910 --> 04:28.450 We are going to use if not exists. 04:28.450 --> 04:29.310 Create table. 04:29.320 --> 04:34.220 If not exist what is the name of the table is student. 04:34.240 --> 04:41.720 I'm going to use a create table and the table name is student and after that. 04:41.750 --> 04:49.760 But we are going to use is we are going to create the query here for that query. 04:49.770 --> 04:53.080 We have parameters that is. 04:53.130 --> 05:06.090 I am having the ID I should be off in the time and ID is also having a primary key and that ID is automatically 05:06.090 --> 05:07.100 incremented. 05:07.320 --> 05:13.680 So auto increment feature is on here for my ID. 05:13.940 --> 05:24.980 After that I warned name and name is all string type so string for that string. 05:25.010 --> 05:29.670 We are having that option in as well. 05:29.780 --> 05:39.650 So here I'm going to mention the size also that his name is very good and it can then up to 100 characters 05:40.280 --> 05:41.340 so off today. 05:41.510 --> 05:45.950 I'm going to mention here the student name is already done. 05:45.950 --> 05:53.690 Student rule number we can say that rule somebody is off and they just type after that. 05:53.970 --> 05:57.710 As weekend can stories we can start here. 05:57.710 --> 06:01.200 The goals values and goals is. 06:01.220 --> 06:10.040 Again we can say their cause is all right and it can contain maximum for the those. 06:10.100 --> 06:19.050 Now this we are going to store the four values in that particular market if I want to store Mock's also. 06:19.050 --> 06:27.430 I want to store marks also and marks results and data type Saltillo. 06:27.770 --> 06:31.160 We are done with that query by using the SQL statement. 06:31.160 --> 06:38.060 We are going to create a table with this query now but we are going to use is here. 06:38.090 --> 06:42.580 I'm going to use the cursor statement which I have declared above. 06:42.900 --> 06:51.460 I'm going to use this girl Sirdar a good statement that I want to execute the above statements. 06:52.440 --> 06:57.790 Now after that curso statement we have the persistence option. 06:58.500 --> 07:05.450 As we have discussed in the database section's persistence options there with the help of falsest option. 07:05.730 --> 07:15.910 So that's why we are going here the persisted Mike Pulse's data file the name of the file is stored 07:15.920 --> 07:17.880 dark baby. 07:18.000 --> 07:24.960 So we are going to use here we are going to use that connection statement not correct option. 07:26.530 --> 07:29.890 We are making this data into the file. 07:30.980 --> 07:42.080 So after the other creation is done now what we are going to use is we are going to insert data into 07:42.310 --> 07:43.800 table. 07:43.880 --> 07:51.380 So for that what we need to do is we need to right there as well Grady for insert the data into the 07:51.530 --> 08:01.420 table so we will write the insert statement here insulting to the name of the table is and the values 08:01.420 --> 08:07.090 which we are going to use is we are having ID. 08:07.120 --> 08:10.790 After that we are having real name. 08:11.500 --> 08:14.220 We are having a role number. 08:14.770 --> 08:21.080 We are having orce and after that we are having Mock's option. 08:21.140 --> 08:32.380 So these are the Fyffe attributes which I'm going to insert the values among these let's say I want 08:32.380 --> 08:35.840 to insert the name as a tool. 08:36.020 --> 08:47.580 After that I want to give the value for Rule number let's say 20 in the name of the courses like ways 08:47.580 --> 08:57.990 we can say the name of the courses and deck and what we can say that is the name of course we have defined 08:59.210 --> 09:06.930 and what we want to do is we have Mock's also let's say the student has scored 50 marks. 09:06.980 --> 09:13.910 Now we will close here and we have stored four values in that particular table. 09:17.320 --> 09:24.300 So we have stored these five values in the table. 09:24.330 --> 09:34.780 So after inspecting the data I will do as I will again call the cursor cursor door at Zeek you and here 09:34.780 --> 09:36.660 in the cursor don't execute. 09:36.730 --> 09:42.250 I need to pause I still because it is there is called Carry. 09:42.310 --> 09:50.950 So I need to pause here the I still hear also in the form of creation what I need to parse is I need 09:50.950 --> 09:54.310 to pause that kill here as well. 09:54.400 --> 09:57.620 So Michael Board exiguous is trading.