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
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

Original subtitles

In the last video, we learned how to create a database, delete a database and create a table using

the Create Table SQL Command.

But this understanding in mind.

Let us now look at how data is added inside the customer table that we created in the last video.

Addition of data in tables is done using the insert into common.

And the syntax for this command is as follows.

Relate in certain to then the table name.

Then within the bracket we may specify the name of the columns.

Specifying column names is optional.

Next comes the key word values, after which we specify the values to be inserted in the record.

Now, if the column names are not specified, the values will be entered in the order of columns.

If I go to my table in pkg admin and see the columns, I open the table.

Here within the table, customer table.

If I open up the columns part, you can see customer ID, first name, last name, age, email ID.

This is the order of columns.

If the values we are entering have some missing attribute.

For example, if there is age or last name missing, then we need to specify the column names after

table name.

All of the values are in different order.

We will need to specify the column names in that particular order.

So let us look at the examples of insert into command.

If you want to insert a single row without mentioning the column names, this is how we do it.

We write insert into table name, which is customer table, and then the values which will have customer

ID, first name, last name, age and email ID of that particular customer.

Now let us go to PG Admin and run this SQL command.

This is my SQL query tool.

I'll start typing insert into.

Customer table.

Then values.

And after that, this will be the customer ID, which is one as this is the first record.

Then the first name, which is B BW.

And note that for strings you need to input the data within single codes.

For numeric integers.

You do not need to do the same thing.

And then the lady would just be.

See at the rate X, y, or Z dot com.

Now select this query and run it.

You can either press F5 or this run query button.

Grady returned successfully, so it was successful.

Now to check whether this command actually added this particular record in our table.

Go to our table.

Right.

Click on it.

Click on View, edit and select all roles.

Below you can see this is how our table is right now looking.

It has one record and that is exactly what we inserted into this table.

In the window above this result, you can see it is running a select command to get this result.

We'll be discussing the select command later.

For now we just use the graphical interface which PD admin provided us to see the table.

Let's go back to the presentation where we'll look at the second example.

And this is a good example.

Suppose the next entry.

We do not have the customer's last name.

Now, if we do not mention the column names, each of the customer will then be filled in the last name.

As that particular field of last name was missing in that record.

To avoid this error, we need to mention the column names after the table name.

So in this example, you can see.

The customer D does not have any last name, so we mentioned the customer ID first name.

Age and email ID as the columns in which values to be filled.

And then we give the values.

So now let's toggle back to admin and run this query also.

Insert into customer table.

Space.

Remember to put brackets and write the column names.

Custody first name.

Then age.

And then email.

We deliberately missed out on the last name.

After this, we values and then mention the Ford values, which will be customer ID of two.

Name is the.

It.

It's 23 and email ID is the at the rate x, y, z dot com.

And on this, a five.

This also was executed successfully.

Go to the table.

Right click view.

Ruth.

You can see for last name, the value is null.

In the last lecture we also discussed there is a constraint called normal.

Had there been a constraint on last name of it being not null, then this particular query would have

given us an error.

Now let's go back to our example and learn how to insert more than one record at the same time with

just one query.

So about two example showed how to add a single row to add multiple rows at the same time.

We just need to list down all the records separated by a comma, this comma.

It is important to remember this common.

Let us go and write this also in dpkg admin window.

You know this index.

Try to beat me typing this query insert into customer table values.

So this is the first record.

With 83 name.

E.

So if.

Age 27.

Email IDF.

The Red x Weather.com.

Goma.

Next entry for Coma G.

Last name H.

Age.

35.

G.

H.

X.

Y.

Z dot com.

And with the semicolon, select this query and run it.

So let us go back and check the data in our table.

It seems.

Got it exactly as we expected.

So did you beat me?

If you did, you are simply awesome at learning this.

Otherwise better next time.

Hold on.

There is another way to add data to tables.

Sometimes the data we want to have in the table is to be imported from a text file or a CSV file.

You may encounter this situation less number of times, but nevertheless it is important to know.

So we'll be learning how to copy a data from a file into a table using the copy command in the next

video.

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