All language subtitles for 5. Import data from File

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
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) Download
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:01,450 --> 00:00:07,270 In the last video, we learned how to insert data into a database using the insert into command. 2 00:00:07,780 --> 00:00:12,490 Let us now learn how to import data from a file into a table. 3 00:00:12,580 --> 00:00:15,130 This can be done using the copy command. 4 00:00:15,580 --> 00:00:17,910 The copy command looks like this. 5 00:00:17,920 --> 00:00:23,890 The syntax of copy command is copy, then the table name and then you mention the columns in which the 6 00:00:23,890 --> 00:00:25,090 data is to be imported. 7 00:00:25,360 --> 00:00:28,030 Then you give the location of the file. 8 00:00:28,120 --> 00:00:29,710 You specify the delimiter. 9 00:00:30,160 --> 00:00:36,070 The delimiter is the symbol which is segregating different columns of your data. 10 00:00:36,430 --> 00:00:38,290 Then comes the type of file. 11 00:00:38,320 --> 00:00:40,930 If it is CSV, we'll write CSV. 12 00:00:41,530 --> 00:00:45,010 Then if the data has headers, we'll write a header. 13 00:00:45,040 --> 00:00:48,850 The header keyword works only if it is a CSV file. 14 00:00:48,850 --> 00:00:52,200 So if it is a text file, the header keyword will not work. 15 00:00:52,210 --> 00:00:56,710 You will have to remove the header from the text file and then import the data. 16 00:00:57,900 --> 00:01:03,750 So to practice this command, we will be importing data from a CSV file and a text file. 17 00:01:04,690 --> 00:01:08,470 Two sample files are attached in the resources section of this lecture. 18 00:01:09,280 --> 00:01:15,040 You can download the files and put it into the same installation directory where your post was installed. 19 00:01:15,610 --> 00:01:18,580 I'll show you where I put my two files. 20 00:01:18,760 --> 00:01:21,080 This is where Post was installed for me. 21 00:01:21,100 --> 00:01:28,240 I created a new folder there and copied the two files that I've attached in the resources section. 22 00:01:29,320 --> 00:01:33,370 Download these two files there and now we'll write the commands. 23 00:01:33,850 --> 00:01:39,580 The reason why we copied these two files in the same installation folder is the SQL Server may not be 24 00:01:39,580 --> 00:01:42,850 able to access the files on your system. 25 00:01:43,270 --> 00:01:46,930 This is the only folder where the files can be accessed by the server. 26 00:01:47,710 --> 00:01:50,170 So now we'll start typing our command. 27 00:01:50,580 --> 00:01:51,820 It starts with copy. 28 00:01:53,760 --> 00:01:54,870 Then they blame. 29 00:01:59,690 --> 00:02:03,590 Then column names if data has different columns. 30 00:02:05,230 --> 00:02:11,170 We did not mention the column names then from the location of file. 31 00:02:12,040 --> 00:02:13,000 To get the address. 32 00:02:13,000 --> 00:02:15,880 You go to the location and check the address bar. 33 00:02:15,910 --> 00:02:19,710 Copy the address from the place within single codes. 34 00:02:19,720 --> 00:02:20,890 Paste this address. 35 00:02:23,400 --> 00:02:25,970 You will need to mention the file name also here. 36 00:02:26,990 --> 00:02:28,640 We just copy CSV. 37 00:02:31,480 --> 00:02:32,320 After this. 38 00:02:33,900 --> 00:02:37,590 Will mention the delimiter, which is comma. 39 00:02:41,930 --> 00:02:45,320 And yes, with the format and my data is headers. 40 00:02:52,990 --> 00:02:55,050 To this query ran successfully. 41 00:02:55,480 --> 00:02:57,070 Let us go and check our table. 42 00:03:03,190 --> 00:03:09,370 Kinsey, five and six customer IDs have been added by this copy statement. 43 00:03:09,550 --> 00:03:16,030 So if you go and open the CSV file in Microsoft Excel, you'll be able to see this is exactly how the 44 00:03:16,030 --> 00:03:17,950 data is present in the Excel file also. 45 00:03:20,670 --> 00:03:23,460 Now let us copy data from a text file. 46 00:03:25,740 --> 00:03:30,120 We can copy this command only and make the changes. 47 00:03:30,660 --> 00:03:32,850 The name is Copy Text. 48 00:03:34,070 --> 00:03:34,810 The OECD. 49 00:03:42,680 --> 00:03:48,200 Delimiter is comma, it is not a CSV file and it cannot identify the header column. 50 00:03:48,650 --> 00:03:52,940 So that is why I deleted the header row from my text file. 51 00:03:55,090 --> 00:03:56,470 Now let us run this command. 52 00:04:00,650 --> 00:04:01,700 Unsuccessfully. 53 00:04:05,490 --> 00:04:06,390 Let us see. 54 00:04:08,650 --> 00:04:16,870 So you can see seven and eight customer IDs have been added by this copy command from the text file. 55 00:04:18,880 --> 00:04:24,010 You can open the text file also to check that the data was separated by a comma. 56 00:04:24,550 --> 00:04:30,910 If you want to change the delimiter, so I'll suggest you go and change the delimiter from comma to 57 00:04:31,000 --> 00:04:38,290 a pipe or a and symbol probably, and then change the delimiter in this query and then run it again. 58 00:04:38,560 --> 00:04:41,220 These are the two ways to insert data into a table. 59 00:04:41,230 --> 00:04:48,310 One is to use the insert into command and the other one is to use the copy command from where you can 60 00:04:48,310 --> 00:04:51,160 copy data from a file to a particular table. 61 00:04:52,070 --> 00:04:58,430 In the next lecture, we will learn how to retrieve the data that we have added to our table. 5625

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