All language subtitles for [SubtitleTools.com] Insert - Learning Oracle 12c [Video]

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,400 --> 00:00:05,300 In this lesson, we'll be taking a look at the Insert statement. 2 00:00:05,300 --> 00:00:08,750 So the Insert statement is going to be used to put data 3 00:00:08,750 --> 00:00:10,940 into a database table. 4 00:00:10,940 --> 00:00:13,860 And we have a couple of ways that we can do this. 5 00:00:13,860 --> 00:00:16,790 So to start with, let's get our connection going. 6 00:00:16,790 --> 00:00:21,510 We're going to use Scott ORCL, click the plus. 7 00:00:21,510 --> 00:00:24,400 And we're going to go ahead and click the plus by the tables, 8 00:00:24,400 --> 00:00:25,820 as well. 9 00:00:25,820 --> 00:00:28,800 So here are Scott's tables. 10 00:00:28,800 --> 00:00:34,380 Let's do a select star from bonus. 11 00:00:34,380 --> 00:00:37,640 And click the Execute or Run statement. 12 00:00:37,640 --> 00:00:41,960 All right, notice here that we have no data in this table. 13 00:00:41,960 --> 00:00:44,930 So this makes it a perfect example for us 14 00:00:44,930 --> 00:00:49,740 to be able to use this to put the Insert statement to work. 15 00:00:49,740 --> 00:00:52,880 So one more thing to show us-- when 16 00:00:52,880 --> 00:00:57,230 we insert the data as we put that data into the table, 17 00:00:57,230 --> 00:01:00,470 we're going to need to know about the types of data 18 00:01:00,470 --> 00:01:01,730 that are in those columns. 19 00:01:01,730 --> 00:01:04,360 And these are going to be data types. 20 00:01:04,360 --> 00:01:09,820 So I'm going to use a command called describe bonus. 21 00:01:09,820 --> 00:01:12,780 All right, so this tells us about the bonus table. 22 00:01:12,780 --> 00:01:18,270 So we have an ENAME column that's a VARCHAR2 10 . 23 00:01:18,270 --> 00:01:20,150 And this means it's a character data 24 00:01:20,150 --> 00:01:24,820 type that's maximum of 10 characters in width. 25 00:01:24,820 --> 00:01:26,570 Then we have a job that's character 26 00:01:26,570 --> 00:01:29,740 data with a maximum of nine. 27 00:01:29,740 --> 00:01:31,390 And then a SAL-- 28 00:01:31,390 --> 00:01:33,340 that's a number-- and a COM-- 29 00:01:33,340 --> 00:01:34,430 that's a number. 30 00:01:34,430 --> 00:01:36,430 So when we do our Insert statement, 31 00:01:36,430 --> 00:01:39,700 we're going to need to conform to those data types. 32 00:01:39,700 --> 00:01:45,180 So the format of an Insert statement will be insert into-- 33 00:01:45,180 --> 00:01:51,420 table name-- values, parentheses, and then 34 00:01:51,420 --> 00:01:52,140 the values. 35 00:01:52,140 --> 00:01:54,000 And this is getting us help here to show us 36 00:01:54,000 --> 00:01:56,430 what those columns are. 37 00:01:56,430 --> 00:02:06,810 So we'll say an ENAME, Fred, job of the manager, salary. 38 00:02:06,810 --> 00:02:09,150 1,700. 39 00:02:09,150 --> 00:02:13,710 And COM, we'll say 3. 40 00:02:13,710 --> 00:02:15,580 All right, so let's take a close look at this 41 00:02:15,580 --> 00:02:18,390 before we execute it. 42 00:02:18,390 --> 00:02:22,560 We use the Insert clause into the bonus table, 43 00:02:22,560 --> 00:02:26,610 then we use the keyword values to specify what we're 44 00:02:26,610 --> 00:02:30,620 going to put into the table. 45 00:02:30,620 --> 00:02:34,090 ENAME corresponds to the value Fred. 46 00:02:34,090 --> 00:02:36,760 Notice that this is a character field. 47 00:02:36,760 --> 00:02:38,890 That's what the VARCHAR2 tells us. 48 00:02:38,890 --> 00:02:41,220 So that we need to make sure that this 49 00:02:41,220 --> 00:02:46,180 is character-based data, and is not larger than 10 characters. 50 00:02:46,180 --> 00:02:49,960 Then we have a comma, and then another character value, 51 00:02:49,960 --> 00:02:54,460 or a VARCHAR2 value, that's no more than nine characters 52 00:02:54,460 --> 00:02:56,080 in width. 53 00:02:56,080 --> 00:02:58,660 Manager, and that corresponds to job. 54 00:02:58,660 --> 00:03:02,380 SAL, we're going to set to a number value of 1,700, 55 00:03:02,380 --> 00:03:05,500 and then COM to a value of 3. 56 00:03:05,500 --> 00:03:09,350 This is what's known as positional notation. 57 00:03:09,350 --> 00:03:12,610 So we're inserting into the table based 58 00:03:12,610 --> 00:03:16,930 on the positions of the values relative to their position 59 00:03:16,930 --> 00:03:17,920 in the table. 60 00:03:17,920 --> 00:03:20,380 So ENAME is the first column-- 61 00:03:20,380 --> 00:03:22,060 this is the first value. 62 00:03:22,060 --> 00:03:24,760 Job is the second column, manager 63 00:03:24,760 --> 00:03:27,910 is the value that corresponds to that, so on and so forth. 64 00:03:27,910 --> 00:03:30,370 So if we don't have the right number of values 65 00:03:30,370 --> 00:03:32,710 that we're passing into the Insert statement, 66 00:03:32,710 --> 00:03:34,430 we'll get an error. 67 00:03:34,430 --> 00:03:36,220 We have to be careful with this, and that's 68 00:03:36,220 --> 00:03:40,120 why we need to know what describe tells us. 69 00:03:40,120 --> 00:03:43,870 It tells us the order of the columns and their data types. 70 00:03:43,870 --> 00:03:47,200 And so if we were to put manager here and Fred here 71 00:03:47,200 --> 00:03:49,810 and switch those, that data would go in, 72 00:03:49,810 --> 00:03:51,990 but it would be incorrect. 73 00:03:51,990 --> 00:03:57,830 So now in order to execute this statement, we'll click Run. 74 00:03:57,830 --> 00:04:00,740 And it tells us one row is inserted. 75 00:04:00,740 --> 00:04:02,200 I'm going to come down here and put 76 00:04:02,200 --> 00:04:08,050 in a second line, select star from bonus. 77 00:04:08,050 --> 00:04:10,430 And Execute. 78 00:04:10,430 --> 00:04:14,390 And here we are with the values that we put in. 79 00:04:14,390 --> 00:04:18,340 So that is positional notation. 80 00:04:18,340 --> 00:04:23,760 We also have what we can call named column notation. 81 00:04:23,760 --> 00:04:32,830 So let's put ENAME, job, SAL, COM, and then the values. 82 00:04:38,560 --> 00:04:40,910 All right, so we were going to insert another row 83 00:04:40,910 --> 00:04:45,180 into the table, only we're going to use name column notation. 84 00:04:45,180 --> 00:04:46,550 And this is where we can actually 85 00:04:46,550 --> 00:04:50,420 name the columns and then their corresponding values. 86 00:04:50,420 --> 00:04:53,010 Now notice here that we've put them in the same order, 87 00:04:53,010 --> 00:04:54,680 but we'll do another example in a second 88 00:04:54,680 --> 00:04:56,880 where we put them in a different order. 89 00:04:56,880 --> 00:04:59,630 So we'll execute this. 90 00:04:59,630 --> 00:05:04,070 Again, rows inserted, select from the table, 91 00:05:04,070 --> 00:05:06,810 and we see the values. 92 00:05:06,810 --> 00:05:10,580 So what would happen if we shifted some things around? 93 00:05:13,730 --> 00:05:19,140 Well, we need to make sure that our values here correspond. 94 00:05:19,140 --> 00:05:26,520 So since job is first, we need to make sure 95 00:05:26,520 --> 00:05:30,450 that we use the value that corresponds to job. 96 00:05:30,450 --> 00:05:40,180 Next is ENAME, then COM, then SAL. 97 00:05:40,180 --> 00:05:45,450 Execute, select the data. 98 00:05:45,450 --> 00:05:47,430 And we see that even though we put the data 99 00:05:47,430 --> 00:05:49,890 in a different order, listed here, 100 00:05:49,890 --> 00:05:52,200 it went in the proper order into the table, 101 00:05:52,200 --> 00:05:56,970 since every value corresponds to the Name column in this list. 102 00:05:56,970 --> 00:05:59,640 So that's what name column notation does-- 103 00:05:59,640 --> 00:06:04,140 it doesn't require us to have these values in the same order 104 00:06:04,140 --> 00:06:06,260 as they are in the table. 8305

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