All language subtitles for 4. INSERT

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French Download
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,560 --> 00:00:09,820 In the last video, we learned how to create a database, delete a database and create a table using 2 00:00:09,820 --> 00:00:11,710 the Create Table SQL Command. 3 00:00:12,770 --> 00:00:14,390 But this understanding in mind. 4 00:00:14,630 --> 00:00:20,750 Let us now look at how data is added inside the customer table that we created in the last video. 5 00:00:22,020 --> 00:00:25,590 Addition of data in tables is done using the insert into common. 6 00:00:26,580 --> 00:00:29,100 And the syntax for this command is as follows. 7 00:00:30,140 --> 00:00:33,590 Relate in certain to then the table name. 8 00:00:33,890 --> 00:00:38,990 Then within the bracket we may specify the name of the columns. 9 00:00:39,680 --> 00:00:41,990 Specifying column names is optional. 10 00:00:43,110 --> 00:00:48,810 Next comes the key word values, after which we specify the values to be inserted in the record. 11 00:00:49,670 --> 00:00:55,220 Now, if the column names are not specified, the values will be entered in the order of columns. 12 00:00:55,310 --> 00:01:02,090 If I go to my table in pkg admin and see the columns, I open the table. 13 00:01:06,020 --> 00:01:09,280 Here within the table, customer table. 14 00:01:09,290 --> 00:01:16,940 If I open up the columns part, you can see customer ID, first name, last name, age, email ID. 15 00:01:16,970 --> 00:01:18,950 This is the order of columns. 16 00:01:20,350 --> 00:01:23,500 If the values we are entering have some missing attribute. 17 00:01:23,950 --> 00:01:30,490 For example, if there is age or last name missing, then we need to specify the column names after 18 00:01:30,490 --> 00:01:31,210 table name. 19 00:01:32,270 --> 00:01:34,220 All of the values are in different order. 20 00:01:34,310 --> 00:01:37,380 We will need to specify the column names in that particular order. 21 00:01:37,400 --> 00:01:40,430 So let us look at the examples of insert into command. 22 00:01:42,320 --> 00:01:47,840 If you want to insert a single row without mentioning the column names, this is how we do it. 23 00:01:48,170 --> 00:01:54,920 We write insert into table name, which is customer table, and then the values which will have customer 24 00:01:54,920 --> 00:02:00,350 ID, first name, last name, age and email ID of that particular customer. 25 00:02:01,330 --> 00:02:04,900 Now let us go to PG Admin and run this SQL command. 26 00:02:05,020 --> 00:02:06,580 This is my SQL query tool. 27 00:02:06,880 --> 00:02:09,010 I'll start typing insert into. 28 00:02:12,850 --> 00:02:13,780 Customer table. 29 00:02:18,660 --> 00:02:19,980 Then values. 30 00:02:22,930 --> 00:02:28,060 And after that, this will be the customer ID, which is one as this is the first record. 31 00:02:28,330 --> 00:02:31,660 Then the first name, which is B BW. 32 00:02:32,020 --> 00:02:37,000 And note that for strings you need to input the data within single codes. 33 00:02:38,020 --> 00:02:39,310 For numeric integers. 34 00:02:39,310 --> 00:02:41,020 You do not need to do the same thing. 35 00:02:42,690 --> 00:02:44,640 And then the lady would just be. 36 00:02:45,850 --> 00:02:49,000 See at the rate X, y, or Z dot com. 37 00:02:55,060 --> 00:02:57,640 Now select this query and run it. 38 00:02:57,670 --> 00:03:00,790 You can either press F5 or this run query button. 39 00:03:02,850 --> 00:03:05,610 Grady returned successfully, so it was successful. 40 00:03:06,590 --> 00:03:12,410 Now to check whether this command actually added this particular record in our table. 41 00:03:12,950 --> 00:03:14,000 Go to our table. 42 00:03:14,030 --> 00:03:14,300 Right. 43 00:03:14,300 --> 00:03:14,990 Click on it. 44 00:03:16,670 --> 00:03:20,570 Click on View, edit and select all roles. 45 00:03:22,830 --> 00:03:26,100 Below you can see this is how our table is right now looking. 46 00:03:26,610 --> 00:03:31,440 It has one record and that is exactly what we inserted into this table. 47 00:03:32,320 --> 00:03:37,300 In the window above this result, you can see it is running a select command to get this result. 48 00:03:37,930 --> 00:03:40,240 We'll be discussing the select command later. 49 00:03:40,960 --> 00:03:47,650 For now we just use the graphical interface which PD admin provided us to see the table. 50 00:03:48,690 --> 00:03:53,160 Let's go back to the presentation where we'll look at the second example. 51 00:03:54,040 --> 00:03:55,380 And this is a good example. 52 00:03:55,750 --> 00:03:58,100 Suppose the next entry. 53 00:03:58,120 --> 00:04:01,300 We do not have the customer's last name. 54 00:04:02,700 --> 00:04:10,050 Now, if we do not mention the column names, each of the customer will then be filled in the last name. 55 00:04:11,050 --> 00:04:15,250 As that particular field of last name was missing in that record. 56 00:04:16,330 --> 00:04:22,210 To avoid this error, we need to mention the column names after the table name. 57 00:04:23,500 --> 00:04:25,630 So in this example, you can see. 58 00:04:26,790 --> 00:04:33,330 The customer D does not have any last name, so we mentioned the customer ID first name. 59 00:04:34,270 --> 00:04:38,500 Age and email ID as the columns in which values to be filled. 60 00:04:38,500 --> 00:04:40,210 And then we give the values. 61 00:04:40,840 --> 00:04:45,220 So now let's toggle back to admin and run this query also. 62 00:04:58,660 --> 00:05:00,580 Insert into customer table. 63 00:05:01,260 --> 00:05:02,030 Space. 64 00:05:02,160 --> 00:05:05,910 Remember to put brackets and write the column names. 65 00:05:07,030 --> 00:05:09,160 Custody first name. 66 00:05:13,250 --> 00:05:14,330 Then age. 67 00:05:16,280 --> 00:05:17,320 And then email. 68 00:05:22,160 --> 00:05:24,680 We deliberately missed out on the last name. 69 00:05:25,040 --> 00:05:32,060 After this, we values and then mention the Ford values, which will be customer ID of two. 70 00:05:32,420 --> 00:05:33,830 Name is the. 71 00:05:36,280 --> 00:05:36,970 It. 72 00:05:37,620 --> 00:05:43,270 It's 23 and email ID is the at the rate x, y, z dot com. 73 00:05:48,100 --> 00:05:49,810 And on this, a five. 74 00:05:53,250 --> 00:05:56,340 This also was executed successfully. 75 00:05:57,210 --> 00:05:58,230 Go to the table. 76 00:05:59,750 --> 00:06:01,280 Right click view. 77 00:06:02,380 --> 00:06:02,870 Ruth. 78 00:06:05,070 --> 00:06:09,150 You can see for last name, the value is null. 79 00:06:09,870 --> 00:06:13,800 In the last lecture we also discussed there is a constraint called normal. 80 00:06:14,490 --> 00:06:20,880 Had there been a constraint on last name of it being not null, then this particular query would have 81 00:06:20,880 --> 00:06:22,020 given us an error. 82 00:06:23,620 --> 00:06:30,700 Now let's go back to our example and learn how to insert more than one record at the same time with 83 00:06:30,700 --> 00:06:31,660 just one query. 84 00:06:32,600 --> 00:06:37,670 So about two example showed how to add a single row to add multiple rows at the same time. 85 00:06:37,970 --> 00:06:43,580 We just need to list down all the records separated by a comma, this comma. 86 00:06:44,940 --> 00:06:46,940 It is important to remember this common. 87 00:06:47,900 --> 00:06:51,980 Let us go and write this also in dpkg admin window. 88 00:07:03,390 --> 00:07:04,770 You know this index. 89 00:07:06,640 --> 00:07:12,220 Try to beat me typing this query insert into customer table values. 90 00:07:15,460 --> 00:07:18,430 So this is the first record. 91 00:07:20,750 --> 00:07:22,940 With 83 name. 92 00:07:25,730 --> 00:07:26,270 E. 93 00:07:27,380 --> 00:07:28,730 So if. 94 00:07:30,860 --> 00:07:32,450 Age 27. 95 00:07:34,010 --> 00:07:35,780 Email IDF. 96 00:07:36,430 --> 00:07:38,180 The Red x Weather.com. 97 00:07:43,340 --> 00:07:43,940 Goma. 98 00:07:45,500 --> 00:07:49,280 Next entry for Coma G. 99 00:07:54,060 --> 00:07:55,410 Last name H. 100 00:08:00,550 --> 00:08:01,240 Age. 101 00:08:02,260 --> 00:08:03,340 35. 102 00:08:04,910 --> 00:08:05,240 G. 103 00:08:05,250 --> 00:08:05,570 H. 104 00:08:06,470 --> 00:08:06,770 X. 105 00:08:06,770 --> 00:08:06,950 Y. 106 00:08:06,980 --> 00:08:08,060 Z dot com. 107 00:08:10,540 --> 00:08:13,870 And with the semicolon, select this query and run it. 108 00:08:22,400 --> 00:08:25,100 So let us go back and check the data in our table. 109 00:08:30,690 --> 00:08:31,080 It seems. 110 00:08:31,080 --> 00:08:33,510 Got it exactly as we expected. 111 00:08:34,780 --> 00:08:35,920 So did you beat me? 112 00:08:37,990 --> 00:08:40,930 If you did, you are simply awesome at learning this. 113 00:08:41,590 --> 00:08:43,150 Otherwise better next time. 114 00:08:43,570 --> 00:08:44,050 Hold on. 115 00:08:44,050 --> 00:08:46,330 There is another way to add data to tables. 116 00:08:47,160 --> 00:08:53,190 Sometimes the data we want to have in the table is to be imported from a text file or a CSV file. 117 00:08:53,610 --> 00:08:58,890 You may encounter this situation less number of times, but nevertheless it is important to know. 118 00:08:59,070 --> 00:09:06,450 So we'll be learning how to copy a data from a file into a table using the copy command in the next 119 00:09:06,450 --> 00:09:06,990 video. 9811

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.