All language subtitles for 1. VIEWS

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: 0 1 00:00:06,656 --> 00:00:07,424 Hi everyone 1 2 00:00:09,216 --> 00:00:11,264 In this video we will learn about views 2 3 00:00:11,520 --> 00:00:12,544 View 3 4 00:00:13,056 --> 00:00:13,824 Is a query 4 5 00:00:14,336 --> 00:00:15,616 It is not a table 5 6 00:00:16,640 --> 00:00:18,176 But it behaves like a table 6 7 00:00:18,688 --> 00:00:20,736 Whenever you will look at a view 7 8 00:00:20,992 --> 00:00:23,808 It will contain contents as a table 8 9 00:00:24,064 --> 00:00:25,856 But it'll actually be a query 9 10 00:00:26,624 --> 00:00:29,184 So this what is the use of this Virtual Table 10 11 00:00:30,208 --> 00:00:31,744 This Virtual Table is used 11 12 00:00:32,000 --> 00:00:32,768 Because 12 13 00:00:33,024 --> 00:00:35,328 This table gives us ease of use 13 14 00:00:36,608 --> 00:00:37,376 Space savings 14 15 00:00:38,144 --> 00:00:39,680 And data security 15 16 00:00:41,728 --> 00:00:43,776 Since it is not an actual table 16 17 00:00:44,032 --> 00:00:46,080 It will not take up space in our database 17 18 00:00:47,104 --> 00:00:47,616 And 18 19 00:00:47,872 --> 00:00:50,176 You can give access of this view 19 20 00:00:50,432 --> 00:00:52,992 To particular users, to particular teams 20 21 00:00:53,248 --> 00:00:56,576 So that they do not look at entirety of your data 21 22 00:00:56,832 --> 00:00:59,648 They just look at only those parts of your data 22 23 00:00:59,904 --> 00:01:04,768 Which are part of this view and you can control the access of every table and every view 23 24 00:01:05,024 --> 00:01:07,328 Which we'll discuss later how to do that 24 25 00:01:08,864 --> 00:01:10,656 The syntax for creating a view is 25 26 00:01:11,168 --> 00:01:12,960 You write create view 26 27 00:01:13,472 --> 00:01:14,752 Name the view 27 28 00:01:15,520 --> 00:01:17,824 And then you write AS keyword 28 29 00:01:18,080 --> 00:01:19,616 After that you specify 29 30 00:01:20,128 --> 00:01:22,944 The select statement, you select the columns from 30 31 00:01:23,200 --> 00:01:27,296 You can have single table multiple tables you can use joins here 31 32 00:01:27,808 --> 00:01:30,368 Whatever is the output of this statement 32 33 00:01:30,624 --> 00:01:31,904 Will be saved 33 34 00:01:32,416 --> 00:01:33,696 As a view 34 35 00:01:34,208 --> 00:01:35,744 And that view will have a name 35 36 00:01:38,816 --> 00:01:40,352 Let's look at an example 36 37 00:01:42,144 --> 00:01:46,496 Suppose that within our supermart we have a Logistics team also 37 38 00:01:46,752 --> 00:01:50,080 Which will be shipping all the orders that we have received 38 39 00:01:50,336 --> 00:01:51,872 To the respective customers 39 40 00:01:53,408 --> 00:01:54,944 To that Logistics team 40 41 00:01:55,200 --> 00:02:01,344 We want to give the data of all the order IDs and the customer details so customer name City 41 42 00:02:01,600 --> 00:02:02,624 state country 42 43 00:02:03,904 --> 00:02:04,928 In a separate table 43 44 00:02:05,440 --> 00:02:09,024 We do not want to show them everything in our database 44 45 00:02:09,280 --> 00:02:12,352 So we create a view specially for them 45 46 00:02:12,864 --> 00:02:15,424 Let us create this view as Logistics 46 47 00:02:15,936 --> 00:02:18,752 And we'll define the columns as order line 47 48 00:02:19,008 --> 00:02:19,776 Order ID 48 49 00:02:20,032 --> 00:02:22,336 Customer name city state country 49 50 00:02:23,104 --> 00:02:27,200 These will be taken from the sales table which is named as a 50 51 00:02:27,712 --> 00:02:29,248 And we left join this 51 52 00:02:30,016 --> 00:02:32,320 Against the customer table which is b 52 53 00:02:32,832 --> 00:02:36,928 The common condition will be customer ID should be same in both the tables 53 54 00:02:37,696 --> 00:02:40,000 And we'll order this by the order line 54 55 00:02:40,256 --> 00:02:41,792 Let us go and create this view 55 56 00:02:43,072 --> 00:02:45,632 Create 56 57 00:02:45,888 --> 00:02:49,472 view name logistics as 57 58 00:02:50,496 --> 00:02:53,056 And start writing select 58 59 00:02:53,824 --> 00:02:57,920 Order line 59 60 00:02:59,200 --> 00:03:00,992 order ID 60 61 00:03:02,784 --> 00:03:06,624 Customer name 61 62 00:03:09,184 --> 00:03:10,720 City 62 63 00:03:14,048 --> 00:03:15,840 State 63 64 00:03:17,888 --> 00:03:18,912 and Country 64 65 00:03:24,544 --> 00:03:27,872 From 65 66 00:03:29,152 --> 00:03:30,944 our sales table 66 67 00:03:31,712 --> 00:03:36,064 Left join with the customers table 67 68 00:03:40,672 --> 00:03:43,744 Common condition will be customer ID 68 69 00:03:48,608 --> 00:03:51,936 And ordered by 69 70 00:03:54,752 --> 00:03:56,544 The order line 70 71 00:04:03,456 --> 00:04:07,552 Select this and run 71 72 00:04:10,624 --> 00:04:16,768 Query was successful you can see the components of this view by 72 73 00:04:17,024 --> 00:04:23,167 Writing select star from the view. so it is behaving 73 74 00:04:23,423 --> 00:04:25,727 just like a table but it is not a table 74 75 00:04:25,983 --> 00:04:28,799 It is a query the query that we have written above 75 76 00:04:29,567 --> 00:04:30,591 The select part 76 77 00:04:31,359 --> 00:04:35,455 Whenever you run the select star, it will give the output of that query 77 78 00:04:35,967 --> 00:04:36,735 So you can see 78 79 00:04:36,991 --> 00:04:40,319 We have this view which contains 79 80 00:04:40,575 --> 00:04:42,367 Order lines order IDs 80 81 00:04:42,623 --> 00:04:45,183 Customer name city state and country 81 82 00:04:46,207 --> 00:04:48,767 So you can give the control of this view 82 83 00:04:49,023 --> 00:04:50,559 the access of this view 83 84 00:04:50,815 --> 00:04:51,327 to 84 85 00:04:51,583 --> 00:04:52,607 Your logistics team 85 86 00:04:55,679 --> 00:05:01,823 Also note that instead of using just create you can write here create or replace view 86 87 00:05:03,103 --> 00:05:03,615 What 87 88 00:05:04,127 --> 00:05:05,663 Benefit that will have is 88 89 00:05:06,175 --> 00:05:07,711 If that view is already 89 90 00:05:07,967 --> 00:05:09,503 Present in your database 90 91 00:05:10,271 --> 00:05:13,087 It will be updated with the new definition that you have given 91 92 00:05:13,855 --> 00:05:14,367 So 92 93 00:05:14,623 --> 00:05:16,927 If it is already present and you have written 93 94 00:05:17,183 --> 00:05:19,487 only create view it will return back 94 95 00:05:19,743 --> 00:05:20,511 as an error 95 96 00:05:21,023 --> 00:05:22,303 The query will fail 96 97 00:05:22,815 --> 00:05:25,119 So instead of writing just create view 97 98 00:05:25,375 --> 00:05:26,143 Probably you should 98 99 00:05:26,399 --> 00:05:28,447 Write create or replace view 99 100 00:05:28,703 --> 00:05:30,751 So that it does not give you an error 100 101 00:05:33,823 --> 00:05:35,615 Now let's see how to 101 102 00:05:36,127 --> 00:05:38,175 Delete a view that you have already created 102 103 00:05:38,431 --> 00:05:40,223 Or if you want to update a view 103 104 00:05:40,735 --> 00:05:42,015 That you are created 104 105 00:05:42,783 --> 00:05:45,087 To delete drop view will be used 105 106 00:05:45,343 --> 00:05:49,439 And to update update command will be used let us go and write these 106 107 00:05:50,207 --> 00:05:52,767 We have created this view. we will delete 107 108 00:05:53,279 --> 00:05:56,351 The logistics view drop view 108 109 00:05:56,607 --> 00:05:59,935 Logistics 109 110 00:06:00,191 --> 00:06:02,751 And this will delete the view 110 111 00:06:04,799 --> 00:06:06,847 This view is gone 111 112 00:06:09,151 --> 00:06:14,015 We do not get any output from this select query since 112 113 00:06:14,271 --> 00:06:16,319 Logistics is not existing anymore 113 114 00:06:17,599 --> 00:06:22,463 If we update a view the data that that particular view has 114 115 00:06:22,975 --> 00:06:25,791 Will be updated. That data is coming from a Table 115 116 00:06:26,559 --> 00:06:28,863 So that particular table will also be updated 116 117 00:06:29,119 --> 00:06:35,263 so writing an update command on a view is similar to updating a table however it is not advisable 117 118 00:06:35,519 --> 00:06:41,407 If you want to update a table you should not go through the view you should directly go and update the table 118 119 00:06:41,663 --> 00:06:45,247 So we'll not update the table using our views right now 119 120 00:06:47,551 --> 00:06:51,391 However if you still want to update a view here are some of the conditions 120 121 00:06:51,647 --> 00:06:53,439 Which your view should meet 121 122 00:06:53,695 --> 00:06:56,511 So when you are defining the view while creating a view 122 123 00:06:56,767 --> 00:06:58,559 The select statement that you have 123 124 00:06:58,815 --> 00:07:04,959 It should meet certain conditions those conditions are listed here I do not advise that you update a view 124 125 00:07:05,471 --> 00:07:10,591 However if you want to, you should look at these conditions once, It'll be part of the presentation 125 126 00:07:11,103 --> 00:07:13,663 Attached in the resources part of this lecture 126 127 00:07:14,943 --> 00:07:16,479 So that is all in the view 127 128 00:07:16,735 --> 00:07:20,063 In the next video we will learn about indexes 9887

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