Tan115 commited on
Commit
ef2dbcb
·
verified ·
1 Parent(s): 79eafa5

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +21 -0
  2. 31 - JDK API/001 StringBuilder & StringBuffer.mp4 +3 -0
  3. 31 - JDK API/002 java.util.Optional - Optional in Java.mp4 +3 -0
  4. 31 - JDK API/003 Reactive Programming in Java Flow API, Reactive Streams.mp4 +3 -0
  5. 32 - Java Platform Module System Modules in Java & Migration of Java Apps/001 Modules in Java Modular Application Example.mp4 +3 -0
  6. 32 - Java Platform Module System Modules in Java & Migration of Java Apps/002 Migration of Java Apps Example of migration to a modular application.mp4 +3 -0
  7. 33 - Testing for Software Engineers/001 Testing for software engineers Overview.mp4 +3 -0
  8. 34 - Unit Testing & JUnit 5/001 Unit Testing & JUnit Overview.mp4 +3 -0
  9. 34 - Unit Testing & JUnit 5/002 JUnit 5 examples VS JUnit 4 + Equivalence class partitioning.mp4 +3 -0
  10. 34 - Unit Testing & JUnit 5/003 JUnit 5 API (Advanced) & Test Code Coverage.mp4 +3 -0
  11. 34 - Unit Testing & JUnit 5/004 JUnit 5 API (Advanced p. 2) & Hamcrest Library.mp4 +3 -0
  12. 35 - Integration testing & Mockito/001 Integration Testing in Java.mp4 +3 -0
  13. 35 - Integration testing & Mockito/002 Mockito Part 1.mp4 +3 -0
  14. 35 - Integration testing & Mockito/003 Mockito Part 2.mp4 +3 -0
  15. 36 - PowerMockito/001 PowerMock.mp4 +3 -0
  16. 37 - TDD, BDD & ATTD/001 Test-driven development Theory.mp4 +3 -0
  17. 37 - TDD, BDD & ATTD/002 BDD & ATTD.mp4 +3 -0
  18. 37 - TDD, BDD & ATTD/003 TDD, BDD & ATTD - Practice.mp4 +3 -0
  19. 38 - Object-oriented Architecture, Clean Code Design (Advanced)/001 Clean Code Architecture, Coupling & Cohesion.mp4 +3 -0
  20. 38 - Object-oriented Architecture, Clean Code Design (Advanced)/002 Tell, Don’t Ask Pricniple & Data Structures.mp4 +3 -0
  21. 38 - Object-oriented Architecture, Clean Code Design (Advanced)/003 Law of Demeter.mp4 +3 -0
  22. 38 - Object-oriented Architecture, Clean Code Design (Advanced)/004 KISS Principle in OOP.mp4 +3 -0
  23. 46 - Databases Overview and Environment Setup/005 Guide-How-to-install-PostgreSQL-on-Mac.url +2 -0
  24. 46 - Databases Overview and Environment Setup/005 PostgreSQL Overview & Installation (including pgAdmin installation)_en.srt +852 -0
  25. 46 - Databases Overview and Environment Setup/005 PostgreSQL-download.url +2 -0
  26. 46 - Databases Overview and Environment Setup/external-links.txt +12 -0
  27. 47 - Relational databases/001 Relational Databases Basic Concepts_en.srt +1320 -0
  28. 47 - Relational databases/002 Create Schema & Table Naming, Collation, Engines, Types, Column Properties_en.srt +1888 -0
  29. 47 - Relational databases/003 Referential Integrity Foreign Key Constraint & Cascading Operations_en.srt +1064 -0
  30. 47 - Relational databases/004 Indexes in Databases_en.srt +988 -0
  31. 47 - Relational databases/005 Database Normalization & Denormalization_en.srt +1576 -0
  32. 48 - SQL/001 MySQL-Documentation-about-statements.url +2 -0
  33. 48 - SQL/001 Query-Examples-that-were-shown-in-the-lesson.url +2 -0
  34. 48 - SQL/001 SQL General Overview & DDL_en.srt +976 -0
  35. 48 - SQL/002 INSERT-statement-documentation.url +2 -0
  36. 48 - SQL/002 Query-Examples-that-were-shown-in-the-lesson.url +2 -0
  37. 48 - SQL/002 SQL DML - CRUD Operations (SELECT, INSERT, UPDATE, DELETE)_en.srt +1380 -0
  38. 48 - SQL/003 JOIN Queries, UNION & Subqueries_en.srt +732 -0
  39. 48 - SQL/003 Query-Examples-that-were-shown-in-the-lesson.url +2 -0
  40. 48 - SQL/external-links.txt +15 -0
  41. 49 - Relational Databases (Advanced)/001 Find-folders-with-Views-Triggers-Stored-Procedures-and-Stored-Functions-SQL-query-examples-here.url +2 -0
  42. 49 - Relational Databases (Advanced)/001 Views, Triggers, Stored Procedures & Functions_en.srt +1548 -0
  43. 49 - Relational Databases (Advanced)/002 MySQL Workbench Administration_en.srt +508 -0
  44. 49 - Relational Databases (Advanced)/external-links.txt +3 -0
  45. 50 - Databases Database Modelling and Architecture/001 Database Modelling & Design Conceptual, Logical and Physical Data Models_en.srt +1160 -0
  46. 51 - ===== SQL Homework Online Shop =====/001 Homework-with-links-to-solution.url +2 -0
  47. 51 - ===== SQL Homework Online Shop =====/001 SQL Homework Task and Solution Review_en.srt +400 -0
  48. 51 - ===== SQL Homework Online Shop =====/external-links.txt +3 -0
  49. 52 - JDBC/001 JDBC Overview Establish connection with DB from Java App_en.srt +988 -0
  50. 52 - JDBC/001 Source-code-example-from-the-lesson.url +2 -0
.gitattributes CHANGED
@@ -541,3 +541,24 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
541
  29[[:space:]]-[[:space:]]Date[[:space:]]and[[:space:]]Time[[:space:]]in[[:space:]]JDK/002[[:space:]]java.time[[:space:]]package[[:space:]](Instant,[[:space:]]LocalDateTime,[[:space:]]ZonedDateTime,[[:space:]]OffsetDateTime[[:space:]]etc).mp4 filter=lfs diff=lfs merge=lfs -text
542
  30[[:space:]]-[[:space:]]Java[[:space:]]Reflection[[:space:]]API/002[[:space:]]Annotations.mp4 filter=lfs diff=lfs merge=lfs -text
543
  30[[:space:]]-[[:space:]]Java[[:space:]]Reflection[[:space:]]API/001[[:space:]]Java[[:space:]]Reflection[[:space:]]API.mp4 filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  29[[:space:]]-[[:space:]]Date[[:space:]]and[[:space:]]Time[[:space:]]in[[:space:]]JDK/002[[:space:]]java.time[[:space:]]package[[:space:]](Instant,[[:space:]]LocalDateTime,[[:space:]]ZonedDateTime,[[:space:]]OffsetDateTime[[:space:]]etc).mp4 filter=lfs diff=lfs merge=lfs -text
542
  30[[:space:]]-[[:space:]]Java[[:space:]]Reflection[[:space:]]API/002[[:space:]]Annotations.mp4 filter=lfs diff=lfs merge=lfs -text
543
  30[[:space:]]-[[:space:]]Java[[:space:]]Reflection[[:space:]]API/001[[:space:]]Java[[:space:]]Reflection[[:space:]]API.mp4 filter=lfs diff=lfs merge=lfs -text
544
+ 31[[:space:]]-[[:space:]]JDK[[:space:]]API/001[[:space:]]StringBuilder[[:space:]]&[[:space:]]StringBuffer.mp4 filter=lfs diff=lfs merge=lfs -text
545
+ 31[[:space:]]-[[:space:]]JDK[[:space:]]API/002[[:space:]]java.util.Optional[[:space:]]-[[:space:]]Optional[[:space:]]in[[:space:]]Java.mp4 filter=lfs diff=lfs merge=lfs -text
546
+ 31[[:space:]]-[[:space:]]JDK[[:space:]]API/003[[:space:]]Reactive[[:space:]]Programming[[:space:]]in[[:space:]]Java[[:space:]]Flow[[:space:]]API,[[:space:]]Reactive[[:space:]]Streams.mp4 filter=lfs diff=lfs merge=lfs -text
547
+ 32[[:space:]]-[[:space:]]Java[[:space:]]Platform[[:space:]]Module[[:space:]]System[[:space:]]Modules[[:space:]]in[[:space:]]Java[[:space:]]&[[:space:]]Migration[[:space:]]of[[:space:]]Java[[:space:]]Apps/001[[:space:]]Modules[[:space:]]in[[:space:]]Java[[:space:]]Modular[[:space:]]Application[[:space:]]Example.mp4 filter=lfs diff=lfs merge=lfs -text
548
+ 32[[:space:]]-[[:space:]]Java[[:space:]]Platform[[:space:]]Module[[:space:]]System[[:space:]]Modules[[:space:]]in[[:space:]]Java[[:space:]]&[[:space:]]Migration[[:space:]]of[[:space:]]Java[[:space:]]Apps/002[[:space:]]Migration[[:space:]]of[[:space:]]Java[[:space:]]Apps[[:space:]]Example[[:space:]]of[[:space:]]migration[[:space:]]to[[:space:]]a[[:space:]]modular[[:space:]]application.mp4 filter=lfs diff=lfs merge=lfs -text
549
+ 33[[:space:]]-[[:space:]]Testing[[:space:]]for[[:space:]]Software[[:space:]]Engineers/001[[:space:]]Testing[[:space:]]for[[:space:]]software[[:space:]]engineers[[:space:]]Overview.mp4 filter=lfs diff=lfs merge=lfs -text
550
+ 34[[:space:]]-[[:space:]]Unit[[:space:]]Testing[[:space:]]&[[:space:]]JUnit[[:space:]]5/001[[:space:]]Unit[[:space:]]Testing[[:space:]]&[[:space:]]JUnit[[:space:]]Overview.mp4 filter=lfs diff=lfs merge=lfs -text
551
+ 34[[:space:]]-[[:space:]]Unit[[:space:]]Testing[[:space:]]&[[:space:]]JUnit[[:space:]]5/002[[:space:]]JUnit[[:space:]]5[[:space:]]examples[[:space:]]VS[[:space:]]JUnit[[:space:]]4[[:space:]]+[[:space:]]Equivalence[[:space:]]class[[:space:]]partitioning.mp4 filter=lfs diff=lfs merge=lfs -text
552
+ 34[[:space:]]-[[:space:]]Unit[[:space:]]Testing[[:space:]]&[[:space:]]JUnit[[:space:]]5/003[[:space:]]JUnit[[:space:]]5[[:space:]]API[[:space:]](Advanced)[[:space:]]&[[:space:]]Test[[:space:]]Code[[:space:]]Coverage.mp4 filter=lfs diff=lfs merge=lfs -text
553
+ 34[[:space:]]-[[:space:]]Unit[[:space:]]Testing[[:space:]]&[[:space:]]JUnit[[:space:]]5/004[[:space:]]JUnit[[:space:]]5[[:space:]]API[[:space:]](Advanced[[:space:]]p.[[:space:]]2)[[:space:]]&[[:space:]]Hamcrest[[:space:]]Library.mp4 filter=lfs diff=lfs merge=lfs -text
554
+ 35[[:space:]]-[[:space:]]Integration[[:space:]]testing[[:space:]]&[[:space:]]Mockito/001[[:space:]]Integration[[:space:]]Testing[[:space:]]in[[:space:]]Java.mp4 filter=lfs diff=lfs merge=lfs -text
555
+ 35[[:space:]]-[[:space:]]Integration[[:space:]]testing[[:space:]]&[[:space:]]Mockito/003[[:space:]]Mockito[[:space:]]Part[[:space:]]2.mp4 filter=lfs diff=lfs merge=lfs -text
556
+ 35[[:space:]]-[[:space:]]Integration[[:space:]]testing[[:space:]]&[[:space:]]Mockito/002[[:space:]]Mockito[[:space:]]Part[[:space:]]1.mp4 filter=lfs diff=lfs merge=lfs -text
557
+ 36[[:space:]]-[[:space:]]PowerMockito/001[[:space:]]PowerMock.mp4 filter=lfs diff=lfs merge=lfs -text
558
+ 37[[:space:]]-[[:space:]]TDD,[[:space:]]BDD[[:space:]]&[[:space:]]ATTD/002[[:space:]]BDD[[:space:]]&[[:space:]]ATTD.mp4 filter=lfs diff=lfs merge=lfs -text
559
+ 37[[:space:]]-[[:space:]]TDD,[[:space:]]BDD[[:space:]]&[[:space:]]ATTD/001[[:space:]]Test-driven[[:space:]]development[[:space:]]Theory.mp4 filter=lfs diff=lfs merge=lfs -text
560
+ 37[[:space:]]-[[:space:]]TDD,[[:space:]]BDD[[:space:]]&[[:space:]]ATTD/003[[:space:]]TDD,[[:space:]]BDD[[:space:]]&[[:space:]]ATTD[[:space:]]-[[:space:]]Practice.mp4 filter=lfs diff=lfs merge=lfs -text
561
+ 38[[:space:]]-[[:space:]]Object-oriented[[:space:]]Architecture,[[:space:]]Clean[[:space:]]Code[[:space:]]Design[[:space:]](Advanced)/001[[:space:]]Clean[[:space:]]Code[[:space:]]Architecture,[[:space:]]Coupling[[:space:]]&[[:space:]]Cohesion.mp4 filter=lfs diff=lfs merge=lfs -text
562
+ 38[[:space:]]-[[:space:]]Object-oriented[[:space:]]Architecture,[[:space:]]Clean[[:space:]]Code[[:space:]]Design[[:space:]](Advanced)/002[[:space:]]Tell,[[:space:]]Don’t[[:space:]]Ask[[:space:]]Pricniple[[:space:]]&[[:space:]]Data[[:space:]]Structures.mp4 filter=lfs diff=lfs merge=lfs -text
563
+ 38[[:space:]]-[[:space:]]Object-oriented[[:space:]]Architecture,[[:space:]]Clean[[:space:]]Code[[:space:]]Design[[:space:]](Advanced)/003[[:space:]]Law[[:space:]]of[[:space:]]Demeter.mp4 filter=lfs diff=lfs merge=lfs -text
564
+ 38[[:space:]]-[[:space:]]Object-oriented[[:space:]]Architecture,[[:space:]]Clean[[:space:]]Code[[:space:]]Design[[:space:]](Advanced)/004[[:space:]]KISS[[:space:]]Principle[[:space:]]in[[:space:]]OOP.mp4 filter=lfs diff=lfs merge=lfs -text
31 - JDK API/001 StringBuilder & StringBuffer.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d5cc34cf132e6d9eb54789ae013a40a9f1a8eb4a6e0fdd4be7a495682324a4c5
3
+ size 198973018
31 - JDK API/002 java.util.Optional - Optional in Java.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05a6090be5c2666cb025f7fce79226f8786b795e2926438ba830722c24209355
3
+ size 126147889
31 - JDK API/003 Reactive Programming in Java Flow API, Reactive Streams.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5812a6bad2ece2300bf3a09e02c4d71b60ef255741dcaaa16e6f4e9ac1709845
3
+ size 281775902
32 - Java Platform Module System Modules in Java & Migration of Java Apps/001 Modules in Java Modular Application Example.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd2f62eb3450831ec0fa0a04dac884857cb3c274f09a9a7900b3de97117c0411
3
+ size 333959321
32 - Java Platform Module System Modules in Java & Migration of Java Apps/002 Migration of Java Apps Example of migration to a modular application.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:640ea7808ff7c1fa1362e105f3dfbad4257cdac0334dfffa23783e617bdef702
3
+ size 108272142
33 - Testing for Software Engineers/001 Testing for software engineers Overview.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78dc8d18cfa0dfd9a411884a73c7810fdcb9dcece693677b61b0482e2fc7c7d4
3
+ size 165860153
34 - Unit Testing & JUnit 5/001 Unit Testing & JUnit Overview.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91600091373bb99c2e80510a800381853fe3edac35284f8f52f71af2be2b3a03
3
+ size 193940702
34 - Unit Testing & JUnit 5/002 JUnit 5 examples VS JUnit 4 + Equivalence class partitioning.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c42f5d00a99ad5ebde08ff0f15503792c8e43e4114bbd185292a045af5028a4
3
+ size 422222136
34 - Unit Testing & JUnit 5/003 JUnit 5 API (Advanced) & Test Code Coverage.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e76672fe30c44c0e88382c952f40f7bee5284176d5bfd82f1c8017e587d9df19
3
+ size 406478979
34 - Unit Testing & JUnit 5/004 JUnit 5 API (Advanced p. 2) & Hamcrest Library.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e821d70c6028558713ad5bea7f3c808cab24eb9504bb90506765d8f327b9348c
3
+ size 338139412
35 - Integration testing & Mockito/001 Integration Testing in Java.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b389672361d28731abb2993d92b42731b2033bdc1aa753ccd0e01d08c8d242c
3
+ size 74575159
35 - Integration testing & Mockito/002 Mockito Part 1.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:beafe7e05dc8a8a0eb8c32c83668abbc5ea525758d24ff1de6d483d40fe17c6b
3
+ size 370926719
35 - Integration testing & Mockito/003 Mockito Part 2.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18c9c727daf0b24b7ee4f143f7ebf08c7fa32c02dc72e62abad5349416e1dd65
3
+ size 96741616
36 - PowerMockito/001 PowerMock.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9bd408bbd2b9f4aaea20ee3b678349bb95e798b5cb6191aa304b8f930415751
3
+ size 275153989
37 - TDD, BDD & ATTD/001 Test-driven development Theory.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3c8bbc3b2ceec6e7417ae910d3306453b5ff9670cbb0d1c2863987f288ae3b1
3
+ size 146705256
37 - TDD, BDD & ATTD/002 BDD & ATTD.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e629f25dd6966d912c05e6cbfcc068d17104e783501ff98ee553d050083e234
3
+ size 98991694
37 - TDD, BDD & ATTD/003 TDD, BDD & ATTD - Practice.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c7e789b857b213698974e5aa4c94c3bc7cb75b26feee6041a3c988dd90e86b0
3
+ size 103663553
38 - Object-oriented Architecture, Clean Code Design (Advanced)/001 Clean Code Architecture, Coupling & Cohesion.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e42ef5c5c1ca0bc5d58e8a2b6d22b8c98f0d0f6a928f625a6a675dc994bb6797
3
+ size 133331095
38 - Object-oriented Architecture, Clean Code Design (Advanced)/002 Tell, Don’t Ask Pricniple & Data Structures.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fe576b710384cebc90d8d39ef98aae4d37adc13a909084fb021dab374cf7e0b
3
+ size 142426666
38 - Object-oriented Architecture, Clean Code Design (Advanced)/003 Law of Demeter.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aca1bd0f480d4ead1a9dcc04fe564b885a51a338ae295dbd8d8f8bee72596594
3
+ size 60398195
38 - Object-oriented Architecture, Clean Code Design (Advanced)/004 KISS Principle in OOP.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49270efe16a3bdc959b6e33f37df46d9d121d3952bc349181a1a33e3506fdca3
3
+ size 270602290
46 - Databases Overview and Environment Setup/005 Guide-How-to-install-PostgreSQL-on-Mac.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://www.postgresqltutorial.com/install-postgresql-macos/
46 - Databases Overview and Environment Setup/005 PostgreSQL Overview & Installation (including pgAdmin installation)_en.srt ADDED
@@ -0,0 +1,852 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:06,000 --> 00:00:10,000
3
+ Hello, dissonance in previous lesson, we hold an overview of my sequel.
4
+
5
+ 2
6
+ 00:00:10,000 --> 00:00:17,000
7
+ Also, we installed it on our laptops, but in this lesson, I would like to refuse you another popular
8
+
9
+ 3
10
+ 00:00:17,000 --> 00:00:21,000
11
+ database management system that is called PostgreSQL.
12
+
13
+ 4
14
+ 00:00:22,000 --> 00:00:29,000
15
+ We're going to study this lesson from general overview of PostgreSQL and its main features after you
16
+
17
+ 5
18
+ 00:00:29,000 --> 00:00:32,000
19
+ become a little bit familiar to this relational database management system.
20
+
21
+ 6
22
+ 00:00:33,000 --> 00:00:35,000
23
+ We'll proceed with practical cause of the lesson.
24
+
25
+ 7
26
+ 00:00:36,000 --> 00:00:43,000
27
+ We're going to install is you progress SQL Server e.g. admin stack builder and come online tools.
28
+
29
+ 8
30
+ 00:00:43,000 --> 00:00:49,000
31
+ The goal of our lesson is to make sure that your environment is ready for further learning of databases.
32
+
33
+ 9
34
+ 00:00:50,000 --> 00:00:54,000
35
+ So I will explain you how to connect the database using Pidgey admin.
36
+
37
+ 10
38
+ 00:00:55,000 --> 00:01:00,000
39
+ I'm going to show you how to create new connections to other PostgreSQL servers.
40
+
41
+ 11
42
+ 00:01:00,000 --> 00:01:01,000
43
+ And then there was a lesson.
44
+
45
+ 12
46
+ 00:01:01,000 --> 00:01:06,000
47
+ You will also understand how to manage progress SQL Windows service.
48
+
49
+ 13
50
+ 00:01:06,000 --> 00:01:08,000
51
+ We have a lot of plans for this lesson.
52
+
53
+ 14
54
+ 00:01:08,000 --> 00:01:10,000
55
+ Let's get it started.
56
+
57
+ 15
58
+ 00:01:11,000 --> 00:01:17,000
59
+ PostgreSQL is a powerful open source object, relational database management system that uses and extends
60
+
61
+ 16
62
+ 00:01:17,000 --> 00:01:20,000
63
+ the sequel then which combined with many features.
64
+
65
+ 17
66
+ 00:01:21,000 --> 00:01:25,000
67
+ Let's safely store and skills the most complicated data workloads.
68
+
69
+ 18
70
+ 00:01:25,000 --> 00:01:33,000
71
+ It's also worth dimensions of possibly a sequel has come a long way since 1986, when it was part of
72
+
73
+ 19
74
+ 00:01:33,000 --> 00:01:40,000
75
+ the PostgreSQL project as the University of California at Berkeley and has more than 30 years of active
76
+
77
+ 20
78
+ 00:01:40,000 --> 00:01:42,000
79
+ development on the core platform.
80
+
81
+ 21
82
+ 00:01:42,000 --> 00:01:48,000
83
+ What a sequel is not controlled by any corporation or other private entity, and the source code is
84
+
85
+ 22
86
+ 00:01:48,000 --> 00:01:50,000
87
+ available free of charge.
88
+
89
+ 23
90
+ 00:01:50,000 --> 00:01:57,000
91
+ PostgreSQL is loved by many developers across all over the world because it has earned a strong reputation
92
+
93
+ 24
94
+ 00:01:57,000 --> 00:02:04,000
95
+ for its proven architecture, reliability, data integrity, robust feature, set extensibility and
96
+
97
+ 25
98
+ 00:02:04,000 --> 00:02:10,000
99
+ so dedication of the open source community behind the software to consistently deliver performant and
100
+
101
+ 26
102
+ 00:02:10,000 --> 00:02:11,000
103
+ innovative solutions.
104
+
105
+ 27
106
+ 00:02:12,000 --> 00:02:16,000
107
+ The sequel is cross-platform, and it runs on all major operating systems.
108
+
109
+ 28
110
+ 00:02:17,000 --> 00:02:24,000
111
+ Also, it is Transaction's compliant since 2001, and this powerful add ons such as the popular post
112
+
113
+ 29
114
+ 00:02:24,000 --> 00:02:27,000
115
+ use spatial database extender.
116
+
117
+ 30
118
+ 00:02:27,000 --> 00:02:33,000
119
+ It is no surprise that possibly a sequel has become the open source relational database of choice for
120
+
121
+ 31
122
+ 00:02:33,000 --> 00:02:35,000
123
+ many people and organizations.
124
+
125
+ 32
126
+ 00:02:35,000 --> 00:02:36,000
127
+ It was great.
128
+
129
+ 33
130
+ 00:02:36,000 --> 00:02:43,000
131
+ Sequel comes with many features aimed to help developers build applications administrators to protect
132
+
133
+ 34
134
+ 00:02:43,000 --> 00:02:49,000
135
+ data integrity and build fault tolerant environments and help you manage your data no matter how big
136
+
137
+ 35
138
+ 00:02:49,000 --> 00:02:51,000
139
+ or small the data set.
140
+
141
+ 36
142
+ 00:02:51,000 --> 00:02:58,000
143
+ And on top of all things that we have already discussed about possible SQL, it is also highly extensible.
144
+
145
+ 37
146
+ 00:02:58,000 --> 00:03:00,000
147
+ What does this mean?
148
+
149
+ 38
150
+ 00:03:00,000 --> 00:03:07,000
151
+ For example, you can define your own data types, build out custom functions, even write code from
152
+
153
+ 39
154
+ 00:03:07,000 --> 00:03:11,000
155
+ different programming languages without compiling your database.
156
+
157
+ 40
158
+ 00:03:11,000 --> 00:03:16,000
159
+ Pretty cool features, don't you think so is a lesson about my school?
160
+
161
+ 41
162
+ 00:03:16,000 --> 00:03:23,000
163
+ We also discussed on the high level existence standards for sequel structured query language, and also
164
+
165
+ 42
166
+ 00:03:23,000 --> 00:03:27,000
167
+ we mention is that each database management system may have its own dialect.
168
+
169
+ 43
170
+ 00:03:28,000 --> 00:03:35,000
171
+ Dialect includes some minor differences in syntax lack of the stated on the PostgreSQL Oracle website,
172
+
173
+ 44
174
+ 00:03:35,000 --> 00:03:42,000
175
+ possibly a tries to conform with the school's standards where such conformance doesn't contradict traditional
176
+
177
+ 45
178
+ 00:03:42,000 --> 00:03:46,000
179
+ features or could lead to pure architectural decisions.
180
+
181
+ 46
182
+ 00:03:47,000 --> 00:03:52,000
183
+ Still, it is not always clear how syntax differences may impact on architectural decisions.
184
+
185
+ 47
186
+ 00:03:52,000 --> 00:03:54,000
187
+ My subjective opinion?
188
+
189
+ 48
190
+ 00:03:54,000 --> 00:03:59,000
191
+ This is just inheritance from times when there were no standards for school.
192
+
193
+ 49
194
+ 00:03:59,000 --> 00:04:06,000
195
+ And as you already know, PostgreSQL is not a new project as a conclusion of dialogue differences.
196
+
197
+ 50
198
+ 00:04:06,000 --> 00:04:12,000
199
+ I'd like to say that many of the features required by the school standards are supported, though sometimes
200
+
201
+ 51
202
+ 00:04:12,000 --> 00:04:15,000
203
+ with slightly different syntax or function.
204
+
205
+ 52
206
+ 00:04:16,000 --> 00:04:18,000
207
+ Let's review core features of a sequel.
208
+
209
+ 53
210
+ 00:04:19,000 --> 00:04:26,000
211
+ Among the features, it is worse dimensions next one's data types, customizations, composite custom
212
+
213
+ 54
214
+ 00:04:26,000 --> 00:04:34,000
215
+ types just in time compilation of expressions Sophisticated Keyword Planner Optimizer Index only scans
216
+
217
+ 55
218
+ 00:04:35,000 --> 00:04:45,000
219
+ multi columns statistics advanced indexing point in time recovery active standbys replication asynchronous
220
+
221
+ 56
222
+ 00:04:45,000 --> 00:04:53,000
223
+ synchronous logical right that log in syndication features multifactor authentication with certificates
224
+
225
+ 57
226
+ 00:04:54,000 --> 00:04:58,000
227
+ and an additional massive support of procedural languages.
228
+
229
+ 58
230
+ 00:04:59,000 --> 00:05:07,000
231
+ Sequel Jason Pass Expressions for data wrappers connect to other databases or streams was a standard
232
+
233
+ 59
234
+ 00:05:07,000 --> 00:05:14,000
235
+ sequel interface many extensions that provide additional functionality, including Porzingis.
236
+
237
+ 60
238
+ 00:05:14,000 --> 00:05:18,000
239
+ These are just some of the features that you can find in possibly a sequel.
240
+
241
+ 61
242
+ 00:05:19,000 --> 00:05:19,000
243
+ Probably.
244
+
245
+ 62
246
+ 00:05:19,000 --> 00:05:24,000
247
+ We can say that you already have an impression about PostgreSQL, and yes, you are right.
248
+
249
+ 63
250
+ 00:05:25,000 --> 00:05:27,000
251
+ This is also called database management system.
252
+
253
+ 64
254
+ 00:05:28,000 --> 00:05:34,000
255
+ This is one of the reasons why it's become popular, so let's now install it on our computers.
256
+
257
+ 65
258
+ 00:05:35,000 --> 00:05:40,000
259
+ The first thing that we need to do is to download distribution back for your operating system.
260
+
261
+ 66
262
+ 00:05:41,000 --> 00:05:45,000
263
+ You can find a link to the download page in attachments to this lesson.
264
+
265
+ 67
266
+ 00:05:45,000 --> 00:05:52,000
267
+ You can find isn't active installer or zip archive was binaries for this tutorial and personally for
268
+
269
+ 68
270
+ 00:05:52,000 --> 00:05:55,000
271
+ myself, I would download Interactive Installer.
272
+
273
+ 69
274
+ 00:05:56,000 --> 00:06:00,000
275
+ I don't want to play hacker game and console to extract binaries.
276
+
277
+ 70
278
+ 00:06:00,000 --> 00:06:03,000
279
+ Also, all examples from the slide off of Windows.
280
+
281
+ 71
282
+ 00:06:04,000 --> 00:06:07,000
283
+ The similar stabs during the installation for Mac OS.
284
+
285
+ 72
286
+ 00:06:08,000 --> 00:06:10,000
287
+ But just in case you can also.
288
+
289
+ 73
290
+ 00:06:10,000 --> 00:06:14,000
291
+ Lines and attachments guide on how to install PostgreSQL on Mac.
292
+
293
+ 74
294
+ 00:06:15,000 --> 00:06:21,000
295
+ Basically, after you selected your operating system, there is a separate page where you can select
296
+
297
+ 75
298
+ 00:06:21,000 --> 00:06:25,000
299
+ what you would like to do, not binaries or installer.
300
+
301
+ 76
302
+ 00:06:25,000 --> 00:06:29,000
303
+ You can make a cup of tea because downloading may take some time.
304
+
305
+ 77
306
+ 00:06:30,000 --> 00:06:31,000
307
+ Once downloading is finished.
308
+
309
+ 78
310
+ 00:06:31,000 --> 00:06:35,000
311
+ Runs interactive installer on the first step.
312
+
313
+ 79
314
+ 00:06:35,000 --> 00:06:36,000
315
+ There is nothing special.
316
+
317
+ 80
318
+ 00:06:36,000 --> 00:06:37,000
319
+ Just welcome message.
320
+
321
+ 81
322
+ 00:06:38,000 --> 00:06:39,000
323
+ Click Next button.
324
+
325
+ 82
326
+ 00:06:40,000 --> 00:06:44,000
327
+ On the next step, make sure you say it's a installation directory.
328
+
329
+ 83
330
+ 00:06:44,000 --> 00:06:47,000
331
+ Once you are ready, click the next button.
332
+
333
+ 84
334
+ 00:06:48,000 --> 00:06:53,000
335
+ On this step, we have to select PostgreSQL components that we want to install.
336
+
337
+ 85
338
+ 00:06:53,000 --> 00:06:56,000
339
+ Let me explain you a little bit about each of this.
340
+
341
+ 86
342
+ 00:06:57,000 --> 00:07:01,000
343
+ Well, PostgreSQL server, it is our core component.
344
+
345
+ 87
346
+ 00:07:01,000 --> 00:07:03,000
347
+ You can treat it as databases.
348
+
349
+ 88
350
+ 00:07:03,000 --> 00:07:09,000
351
+ So DG Admin is a client you are to interact with supposedly a SQL server.
352
+
353
+ 89
354
+ 00:07:10,000 --> 00:07:16,000
355
+ The Stack Builder utility provides a graphical interface that simplifies the process of downloading
356
+
357
+ 90
358
+ 00:07:16,000 --> 00:07:21,000
359
+ and installing modules that complement your Cosmos sequel installation.
360
+
361
+ 91
362
+ 00:07:22,000 --> 00:07:28,000
363
+ When you install a module with Stack Builder, Stack Builder automatically resolves any software dependencies.
364
+
365
+ 92
366
+ 00:07:29,000 --> 00:07:36,000
367
+ So this nice tool to have installed just in case and another component is a command line tools that
368
+
369
+ 93
370
+ 00:07:36,000 --> 00:07:40,000
371
+ they use to interact with PostgreSQL with the help of command line.
372
+
373
+ 94
374
+ 00:07:41,000 --> 00:07:44,000
375
+ I recommend you also to install this just in case.
376
+
377
+ 95
378
+ 00:07:45,000 --> 00:07:47,000
379
+ After that, click next button.
380
+
381
+ 96
382
+ 00:07:47,000 --> 00:07:53,000
383
+ After that, you have opportunity to configure passed as a folder where your data will be stored.
384
+
385
+ 97
386
+ 00:07:54,000 --> 00:08:00,000
387
+ By default, you will be offered to create a data folder in PostgreSQL Installation Directory.
388
+
389
+ 98
390
+ 00:08:01,000 --> 00:08:04,000
391
+ If this is OK for you, then just press next button.
392
+
393
+ 99
394
+ 00:08:05,000 --> 00:08:13,000
395
+ On the next step, please write a password for a super user who has all rights in database having access
396
+
397
+ 100
398
+ 00:08:13,000 --> 00:08:19,000
399
+ to this user, you can start creation of other users, schemas, tables and so on.
400
+
401
+ 101
402
+ 00:08:19,000 --> 00:08:21,000
403
+ Please remember this password.
404
+
405
+ 102
406
+ 00:08:22,000 --> 00:08:23,000
407
+ This is important.
408
+
409
+ 103
410
+ 00:08:24,000 --> 00:08:31,000
411
+ Was Great Article is an app that will be running on our computer and to get connected to the PostgreSQL,
412
+
413
+ 104
414
+ 00:08:31,000 --> 00:08:34,000
415
+ we need to know port number on this computer.
416
+
417
+ 105
418
+ 00:08:35,000 --> 00:08:40,000
419
+ And the biggest lesson when we installed my I explained what is port number.
420
+
421
+ 106
422
+ 00:08:41,000 --> 00:08:46,000
423
+ Also, I have separate course about that programming where I cover network concept.
424
+
425
+ 107
426
+ 00:08:46,000 --> 00:08:48,000
427
+ Just to remind you a few words about Port.
428
+
429
+ 108
430
+ 00:08:48,000 --> 00:08:49,000
431
+ No.
432
+
433
+ 109
434
+ 00:08:49,000 --> 00:08:52,000
435
+ We are going to use it as part of address.
436
+
437
+ 110
438
+ 00:08:52,000 --> 00:09:00,000
439
+ One will connect to the possible SQL server, and if IP address is an address of our machines network,
440
+
441
+ 111
442
+ 00:09:01,000 --> 00:09:05,000
443
+ then port number is an address of the app on this specific machine.
444
+
445
+ 112
446
+ 00:09:06,000 --> 00:09:14,000
447
+ The default port, of course, with a sequel, is 54 so that you can change it if you wish.
448
+
449
+ 113
450
+ 00:09:14,000 --> 00:09:20,000
451
+ And if for some reason this sport is already captured by other app, in my case, I just click next
452
+
453
+ 114
454
+ 00:09:21,000 --> 00:09:24,000
455
+ select lock collar that works the best for you.
456
+
457
+ 115
458
+ 00:09:25,000 --> 00:09:29,000
459
+ This configuration will impact all the collaboration settings of the app.
460
+
461
+ 116
462
+ 00:09:29,000 --> 00:09:32,000
463
+ Don't worry, you will be able to change this later, too.
464
+
465
+ 117
466
+ 00:09:33,000 --> 00:09:40,000
467
+ You can keep the folder color option and click Next button on this snap check installation information.
468
+
469
+ 118
470
+ 00:09:40,000 --> 00:09:46,000
471
+ And if everything looks good to you, press it to the next step and start installation.
472
+
473
+ 119
474
+ 00:09:47,000 --> 00:09:52,000
475
+ If installation finished successfully, you would see a notification about installation completion.
476
+
477
+ 120
478
+ 00:09:53,000 --> 00:09:55,000
479
+ You will be offered the launch stack builder.
480
+
481
+ 121
482
+ 00:09:56,000 --> 00:09:58,000
483
+ You can keep this checkbox marked if you wish.
484
+
485
+ 122
486
+ 00:09:59,000 --> 00:10:02,000
487
+ And afterwards, just press finish button.
488
+
489
+ 123
490
+ 00:10:02,000 --> 00:10:03,000
491
+ And that's it.
492
+
493
+ 124
494
+ 00:10:03,000 --> 00:10:09,000
495
+ Congrats, PostgreSQL installed on your computer with all other components.
496
+
497
+ 125
498
+ 00:10:09,000 --> 00:10:15,000
499
+ So in case you kept chequebooks smart, you would have struggled to open.
500
+
501
+ 126
502
+ 00:10:15,000 --> 00:10:18,000
503
+ But what to do with it in the future?
504
+
505
+ 127
506
+ 00:10:18,000 --> 00:10:25,000
507
+ You can run it separately in case you want to install some advanced PostgreSQL, for example.
508
+
509
+ 128
510
+ 00:10:25,000 --> 00:10:29,000
511
+ On the slide, you can see just an example of what can be installed.
512
+
513
+ 129
514
+ 00:10:30,000 --> 00:10:33,000
515
+ We don't need anything from this list at this moment.
516
+
517
+ 130
518
+ 00:10:33,000 --> 00:10:35,000
519
+ Sewa Just Glow Stack Builder.
520
+
521
+ 131
522
+ 00:10:36,000 --> 00:10:43,000
523
+ Let's understand now how to run PostgreSQL, and let's test that interaction with databases is configured
524
+
525
+ 132
526
+ 00:10:43,000 --> 00:10:43,000
527
+ properly.
528
+
529
+ 133
530
+ 00:10:44,000 --> 00:10:50,000
531
+ And various lessons, I also explained you what Windows service is just to remind you.
532
+
533
+ 134
534
+ 00:10:50,000 --> 00:10:58,000
535
+ Windows services are core components of the Microsoft Windows operating system and enables the creation
536
+
537
+ 135
538
+ 00:10:58,000 --> 00:11:02,000
539
+ and management of long running processes right after installation.
540
+
541
+ 136
542
+ 00:11:03,000 --> 00:11:06,000
543
+ You have PostgreSQL Windows service up and running.
544
+
545
+ 137
546
+ 00:11:06,000 --> 00:11:10,000
547
+ You can check this by opening services on your Windows machine.
548
+
549
+ 138
550
+ 00:11:10,000 --> 00:11:16,000
551
+ Also in this place, you can either stop the service or configure startup time.
552
+
553
+ 139
554
+ 00:11:16,000 --> 00:11:23,000
555
+ For example, I keep my school service started automatically, started that and my PostgreSQL service
556
+
557
+ 140
558
+ 00:11:23,000 --> 00:11:29,000
559
+ I keep in manual starts up because I don't see a lot of reasons to load.
560
+
561
+ 141
562
+ 00:11:29,000 --> 00:11:32,000
563
+ My machine was to databases run in Perl.
564
+
565
+ 142
566
+ 00:11:32,000 --> 00:11:36,000
567
+ Definitely for this demo I turned PostgreSQL service on.
568
+
569
+ 143
570
+ 00:11:37,000 --> 00:11:40,000
571
+ Now you know the place where this may be configured.
572
+
573
+ 144
574
+ 00:11:41,000 --> 00:11:41,000
575
+ Great.
576
+
577
+ 145
578
+ 00:11:42,000 --> 00:11:46,000
579
+ Now, let's learn how to work with supposedly equals through the nice UI.
580
+
581
+ 146
582
+ 00:11:46,000 --> 00:11:53,000
583
+ We have separate applications that we have also already installed and that the so-called admin to start
584
+
585
+ 147
586
+ 00:11:53,000 --> 00:11:57,000
587
+ at least navigate to the installation directory of possible sequel.
588
+
589
+ 148
590
+ 00:11:58,000 --> 00:12:01,000
591
+ You're going to find a separate folder was named A.G. Admin.
592
+
593
+ 149
594
+ 00:12:02,000 --> 00:12:06,000
595
+ Open it and find the executable file with the same name.
596
+
597
+ 150
598
+ 00:12:07,000 --> 00:12:11,000
599
+ Double click it and Beijing admin app will start loading.
600
+
601
+ 151
602
+ 00:12:12,000 --> 00:12:16,000
603
+ On the first start up, you will be asked to set and must have passwords for page admin.
604
+
605
+ 152
606
+ 00:12:17,000 --> 00:12:23,000
607
+ This is needed because potentially you can have multiple connections and server configuration stored
608
+
609
+ 153
610
+ 00:12:23,000 --> 00:12:26,000
611
+ in the app to secure the setup on each startup.
612
+
613
+ 154
614
+ 00:12:26,000 --> 00:12:34,000
615
+ This app will ask you a master password, so also remember the password and press OK button?
616
+
617
+ 155
618
+ 00:12:35,000 --> 00:12:38,000
619
+ The next thing that we need to do is to connect through an existing server.
620
+
621
+ 156
622
+ 00:12:38,000 --> 00:12:40,000
623
+ We have page admin.
624
+
625
+ 157
626
+ 00:12:40,000 --> 00:12:47,000
627
+ You just need to expand servers in the left panel and you will find the server that's already exists
628
+
629
+ 158
630
+ 00:12:47,000 --> 00:12:48,000
631
+ on your local hosts.
632
+
633
+ 159
634
+ 00:12:49,000 --> 00:12:52,000
635
+ This is exactly the server that we have just installed.
636
+
637
+ 160
638
+ 00:12:52,000 --> 00:12:59,000
639
+ Click on it and you will be prompted to enter your password and to share passwords with you, said during
640
+
641
+ 161
642
+ 00:12:59,000 --> 00:13:00,000
643
+ the installation.
644
+
645
+ 162
646
+ 00:13:01,000 --> 00:13:04,000
647
+ You can save passwords in page admin if you wish.
648
+
649
+ 163
650
+ 00:13:04,000 --> 00:13:06,000
651
+ And press OK button.
652
+
653
+ 164
654
+ 00:13:07,000 --> 00:13:08,000
655
+ Congrats, team.
656
+
657
+ 165
658
+ 00:13:08,000 --> 00:13:10,000
659
+ We managed to connect to our Sara.
660
+
661
+ 166
662
+ 00:13:11,000 --> 00:13:17,000
663
+ That is great on the home page, you can see some charts and information about performance.
664
+
665
+ 167
666
+ 00:13:17,000 --> 00:13:21,000
667
+ There are also a lot of other things that we can do from this point.
668
+
669
+ 168
670
+ 00:13:21,000 --> 00:13:25,000
671
+ But all of this will be discussed in separate lessons in details.
672
+
673
+ 169
674
+ 00:13:26,000 --> 00:13:31,000
675
+ The most important thing is that you successfully managed to connect as a possible SQL server.
676
+
677
+ 170
678
+ 00:13:32,000 --> 00:13:34,000
679
+ Let me show you one more interesting thing.
680
+
681
+ 171
682
+ 00:13:34,000 --> 00:13:40,000
683
+ You can always connect the remote database knowing the exact address of the PostgreSQL.
684
+
685
+ 172
686
+ 00:13:41,000 --> 00:13:48,000
687
+ Let me show you now how to add new silver collection service and then click Add New Server.
688
+
689
+ 173
690
+ 00:13:49,000 --> 00:13:56,000
691
+ Now we need just some information about servers that we want to connect on the general tap.
692
+
693
+ 174
694
+ 00:13:56,000 --> 00:14:01,000
695
+ Just enter the names that would be easy to recognize for you and Server Group.
696
+
697
+ 175
698
+ 00:14:01,000 --> 00:14:07,000
699
+ You can group different service together to navigate easily between them later when needed.
700
+
701
+ 176
702
+ 00:14:08,000 --> 00:14:14,000
703
+ After that, you need to choose connection type to the server and configure it separately in the top
704
+
705
+ 177
706
+ 00:14:14,000 --> 00:14:14,000
707
+ bar.
708
+
709
+ 178
710
+ 00:14:14,000 --> 00:14:16,000
711
+ You can see different apps.
712
+
713
+ 179
714
+ 00:14:16,000 --> 00:14:18,000
715
+ They are connection.
716
+
717
+ 180
718
+ 00:14:18,000 --> 00:14:20,000
719
+ This one is for connections.
720
+
721
+ 181
722
+ 00:14:20,000 --> 00:14:23,000
723
+ We are TCP IP Protocol SSL.
724
+
725
+ 182
726
+ 00:14:24,000 --> 00:14:27,000
727
+ This step is to configure connection with SSL.
728
+
729
+ 183
730
+ 00:14:28,000 --> 00:14:30,000
731
+ SSL stands for Secure Sockets Layer.
732
+
733
+ 184
734
+ 00:14:31,000 --> 00:14:34,000
735
+ And again, we're going to learn web in a separate course.
736
+
737
+ 185
738
+ 00:14:35,000 --> 00:14:40,000
739
+ This protocol runs on top of this IP protocol as a secret tunnel.
740
+
741
+ 186
742
+ 00:14:41,000 --> 00:14:44,000
743
+ On that one tab, you can configure SSL connection.
744
+
745
+ 187
746
+ 00:14:45,000 --> 00:14:52,000
747
+ In no particular case, I want to use Connection tab to configure connection with TCP IP protocol in
748
+
749
+ 188
750
+ 00:14:52,000 --> 00:14:53,000
751
+ host address.
752
+
753
+ 189
754
+ 00:14:53,000 --> 00:14:55,000
755
+ You should put the address of the host.
756
+
757
+ 190
758
+ 00:14:55,000 --> 00:14:57,000
759
+ Usually, this is an IP address.
760
+
761
+ 191
762
+ 00:14:58,000 --> 00:15:01,000
763
+ In this example, I'm going to connect to my localhost.
764
+
765
+ 192
766
+ 00:15:02,000 --> 00:15:07,000
767
+ This IP always refers to the local host, or you can just use local hostname.
768
+
769
+ 193
770
+ 00:15:07,000 --> 00:15:14,000
771
+ In this particular example, localhost is a hostname which refers to the current computer used to access
772
+
773
+ 194
774
+ 00:15:14,000 --> 00:15:14,000
775
+ it.
776
+
777
+ 195
778
+ 00:15:15,000 --> 00:15:23,000
779
+ I use default port for possible sequel, so I put value 50 four course suited to in the ports field
780
+
781
+ 196
782
+ 00:15:23,000 --> 00:15:25,000
783
+ in maintenance database.
784
+
785
+ 197
786
+ 00:15:25,000 --> 00:15:28,000
787
+ Put Pause Grass What is maintenance database?
788
+
789
+ 198
790
+ 00:15:28,000 --> 00:15:34,000
791
+ Zip Postgres database is also created when a database cluster is initialized.
792
+
793
+ 199
794
+ 00:15:35,000 --> 00:15:41,000
795
+ This database is meant as a default database for users and applications to connect to.
796
+
797
+ 200
798
+ 00:15:41,000 --> 00:15:45,000
799
+ After that, we need to specify a name of the user.
800
+
801
+ 201
802
+ 00:15:45,000 --> 00:15:49,000
803
+ The name of our admin user by default is progress.
804
+
805
+ 202
806
+ 00:15:50,000 --> 00:15:53,000
807
+ Also, we have to use the password for this user.
808
+
809
+ 203
810
+ 00:15:53,000 --> 00:15:58,000
811
+ And after all configurations are on, please just click Save button.
812
+
813
+ 204
814
+ 00:15:59,000 --> 00:16:02,000
815
+ That's all what I wanted to share with you in this lesson.
816
+
817
+ 205
818
+ 00:16:02,000 --> 00:16:08,000
819
+ Let's recap what we have learned today in this lesson we hold PostgreSQL over.
820
+
821
+ 206
822
+ 00:16:08,000 --> 00:16:10,000
823
+ You removed its main features.
824
+
825
+ 207
826
+ 00:16:11,000 --> 00:16:15,000
827
+ After that, we proceed with the practice space to prepare environment.
828
+
829
+ 208
830
+ 00:16:15,000 --> 00:16:21,000
831
+ We installed Postgres, SQL Server, PJ Admin, Stack Builder and command line tools.
832
+
833
+ 209
834
+ 00:16:22,000 --> 00:16:25,000
835
+ I showed you an example How to connect to Postgres SQL Server.
836
+
837
+ 210
838
+ 00:16:25,000 --> 00:16:30,000
839
+ We are Pidgey admin and how to create a new server inside paging admin.
840
+
841
+ 211
842
+ 00:16:31,000 --> 00:16:37,000
843
+ Also, I explained how and where you can configure Windows servers for Postgres sequel.
844
+
845
+ 212
846
+ 00:16:38,000 --> 00:16:40,000
847
+ Thank you all team for your attention.
848
+
849
+ 213
850
+ 00:16:40,000 --> 00:16:43,000
851
+ Have a great day and see you in the next lesson.
852
+
46 - Databases Overview and Environment Setup/005 PostgreSQL-download.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://www.postgresql.org/download/
46 - Databases Overview and Environment Setup/external-links.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ 004 Microsoft-MySQL-Installer
3
+ https://dev.mysql.com/downloads/installer/
4
+
5
+ 004 How-to-Install-MySQL-on-MacOS
6
+ https://dev.mysql.com/doc/refman/8.0/en/macos-installation-pkg.html
7
+
8
+ 005 PostgreSQL-download
9
+ https://www.postgresql.org/download/
10
+
11
+ 005 Guide-How-to-install-PostgreSQL-on-Mac
12
+ https://www.postgresqltutorial.com/install-postgresql-macos/
47 - Relational databases/001 Relational Databases Basic Concepts_en.srt ADDED
@@ -0,0 +1,1320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:05,000 --> 00:00:06,000
3
+ Hello, Jim.
4
+
5
+ 2
6
+ 00:00:06,000 --> 00:00:10,000
7
+ And this last one, we're going to start learning the relational databases.
8
+
9
+ 3
10
+ 00:00:11,000 --> 00:00:17,000
11
+ We're going to start from understanding of basic concepts and gradually we'll move to more complicated
12
+
13
+ 4
14
+ 00:00:17,000 --> 00:00:17,000
15
+ topics.
16
+
17
+ 5
18
+ 00:00:18,000 --> 00:00:26,000
19
+ We're going to start our lesson with learning such basic terms a stable entity, absolute chapel records,
20
+
21
+ 6
22
+ 00:00:26,000 --> 00:00:32,000
23
+ etc. separate focus on the good and the differences between database and schema.
24
+
25
+ 7
26
+ 00:00:32,000 --> 00:00:38,000
27
+ Because very often my students ask me what is schema and how it is different from database.
28
+
29
+ 8
30
+ 00:00:39,000 --> 00:00:43,000
31
+ After that, we are going to learn such important concept as primary key.
32
+
33
+ 9
34
+ 00:00:43,000 --> 00:00:48,000
35
+ I will share with you different examples, and that will help you to understand the difference between
36
+
37
+ 10
38
+ 00:00:48,000 --> 00:00:52,000
39
+ simple and compound key, natural and surrogate key.
40
+
41
+ 11
42
+ 00:00:53,000 --> 00:00:58,000
43
+ Also, you will learn what alternate care is to understand relationships in databases.
44
+
45
+ 12
46
+ 00:00:58,000 --> 00:01:05,000
47
+ We need to learn what foreign key is, and once we learn all these terms will start none of the relationships
48
+
49
+ 13
50
+ 00:01:05,000 --> 00:01:06,000
51
+ in relational databases.
52
+
53
+ 14
54
+ 00:01:07,000 --> 00:01:12,000
55
+ You're going to understand what types of relationship we have and how they're different from each other.
56
+
57
+ 15
58
+ 00:01:13,000 --> 00:01:19,000
59
+ Let's start our lesson before we start dive deeper into the details of relational databases.
60
+
61
+ 16
62
+ 00:01:20,000 --> 00:01:25,000
63
+ Let's learn some basic terms that we are going to use during today's lesson and future lessons.
64
+
65
+ 17
66
+ 00:01:25,000 --> 00:01:29,000
67
+ Let's go over each channel one by one database.
68
+
69
+ 18
70
+ 00:01:30,000 --> 00:01:35,000
71
+ We use this term usually to refer to a set of tables with some data in them.
72
+
73
+ 19
74
+ 00:01:36,000 --> 00:01:36,000
75
+ Is that clear?
76
+
77
+ 20
78
+ 00:01:37,000 --> 00:01:38,000
79
+ I believe there is one more question.
80
+
81
+ 21
82
+ 00:01:39,000 --> 00:01:40,000
83
+ What are tables?
84
+
85
+ 22
86
+ 00:01:41,000 --> 00:01:47,000
87
+ Tables and metrics with data of the specified format in table, you have rows and columns.
88
+
89
+ 23
90
+ 00:01:47,000 --> 00:01:49,000
91
+ Each column has name.
92
+
93
+ 24
94
+ 00:01:49,000 --> 00:01:56,000
95
+ Also, each column has data that we can specify what kind of data will be stored in this column.
96
+
97
+ 25
98
+ 00:01:57,000 --> 00:02:03,000
99
+ Topple in relational databases, we use this term to describe one records of data.
100
+
101
+ 26
102
+ 00:02:03,000 --> 00:02:06,000
103
+ OK, so what is the records?
104
+
105
+ 27
106
+ 00:02:06,000 --> 00:02:09,000
107
+ Records is one row in table.
108
+
109
+ 28
110
+ 00:02:09,000 --> 00:02:16,000
111
+ Let's continue with other terms is we need to be familiar with entity and entity is distinguishable.
112
+
113
+ 29
114
+ 00:02:16,000 --> 00:02:23,000
115
+ The real world object that exists and the object should not be considered as an entity until it can
116
+
117
+ 30
118
+ 00:02:23,000 --> 00:02:27,000
119
+ be easily identified from all other objects of the real world.
120
+
121
+ 31
122
+ 00:02:28,000 --> 00:02:36,000
123
+ In other simple words, if you can't identify sets of characteristics that define some object in a unique
124
+
125
+ 32
126
+ 00:02:36,000 --> 00:02:43,000
127
+ way, which allows you to store data about objects or if you are not going to retrieve data about some
128
+
129
+ 33
130
+ 00:02:43,000 --> 00:02:48,000
131
+ object, then there is no point in creating that entity in a database.
132
+
133
+ 34
134
+ 00:02:49,000 --> 00:02:50,000
135
+ Does it make sense?
136
+
137
+ 35
138
+ 00:02:51,000 --> 00:02:58,000
139
+ Attribute Attribute is a characteristic in a database management system and attributes refers to database
140
+
141
+ 36
142
+ 00:02:58,000 --> 00:03:05,000
143
+ field attributes, describes the characteristics or properties of an entity in a database table and
144
+
145
+ 37
146
+ 00:03:05,000 --> 00:03:10,000
147
+ the entity in a database table is defined was a fixed set of actions.
148
+
149
+ 38
150
+ 00:03:11,000 --> 00:03:16,000
151
+ For example, you will have to define a user entity that we can define.
152
+
153
+ 39
154
+ 00:03:16,000 --> 00:03:20,000
155
+ It was a set of attributes like email, name, etc..
156
+
157
+ 40
158
+ 00:03:21,000 --> 00:03:27,000
159
+ The attribute values of each user entity will define its characteristics in the table.
160
+
161
+ 41
162
+ 00:03:28,000 --> 00:03:36,000
163
+ In most simple words, attributes are columns in database tables, and each row has set of common values.
164
+
165
+ 42
166
+ 00:03:36,000 --> 00:03:40,000
167
+ Those are attributes, but this is very simplified definition.
168
+
169
+ 43
170
+ 00:03:41,000 --> 00:03:48,000
171
+ There is also one more chance that we have learned to use often today in the lesson schema analysis
172
+
173
+ 44
174
+ 00:03:48,000 --> 00:03:53,000
175
+ schema is an abstract designs its represent the storage of your data in a database.
176
+
177
+ 45
178
+ 00:03:53,000 --> 00:04:01,000
179
+ It describes both zircon zation of data and the relationships between tables in a given database.
180
+
181
+ 46
182
+ 00:04:01,000 --> 00:04:07,000
183
+ Sometimes you can find that people use schema and database as interchangeable terms.
184
+
185
+ 47
186
+ 00:04:07,000 --> 00:04:09,000
187
+ But this is not correct.
188
+
189
+ 48
190
+ 00:04:09,000 --> 00:04:16,000
191
+ The fundamental difference between them is that the database is an organized collection of internal
192
+
193
+ 49
194
+ 00:04:16,000 --> 00:04:23,000
195
+ data data, and on the other hand, the schema is a logical representation or description of an entire
196
+
197
+ 50
198
+ 00:04:23,000 --> 00:04:23,000
199
+ database.
200
+
201
+ 51
202
+ 00:04:24,000 --> 00:04:31,000
203
+ Schema contains the structure of tables, attributes that types, constraints and how they relate to
204
+
205
+ 52
206
+ 00:04:31,000 --> 00:04:32,000
207
+ other tables.
208
+
209
+ 53
210
+ 00:04:32,000 --> 00:04:35,000
211
+ Do you feel the difference between these two terms?
212
+
213
+ 54
214
+ 00:04:36,000 --> 00:04:38,000
215
+ These are just basic terms.
216
+
217
+ 55
218
+ 00:04:38,000 --> 00:04:39,000
219
+ Tsarist jumps were.
220
+
221
+ 56
222
+ 00:04:39,000 --> 00:04:42,000
223
+ I go on to those examples as we go.
224
+
225
+ 57
226
+ 00:04:42,000 --> 00:04:43,000
227
+ Is that clear?
228
+
229
+ 58
230
+ 00:04:44,000 --> 00:04:46,000
231
+ If yes, then let's proceed.
232
+
233
+ 59
234
+ 00:04:47,000 --> 00:04:50,000
235
+ Another important term in a relational databases is a primary key.
236
+
237
+ 60
238
+ 00:04:51,000 --> 00:04:58,000
239
+ I decided to dedicate a separate slide to reviews the definition so primary key is a specific choice
240
+
241
+ 61
242
+ 00:04:58,000 --> 00:05:00,000
243
+ of minimal set of attributes.
244
+
245
+ 62
246
+ 00:05:00,000 --> 00:05:07,000
247
+ And you already know that attributes many columns that uniquely identify, topple and you learn, you
248
+
249
+ 63
250
+ 00:05:07,000 --> 00:05:11,000
251
+ know, that tadpole is a synonym to row in the table.
252
+
253
+ 64
254
+ 00:05:11,000 --> 00:05:19,000
255
+ In most simple words, primary key is an attribute or unique set of attributes that can identify specific
256
+
257
+ 65
258
+ 00:05:19,000 --> 00:05:21,000
259
+ rule in the book, among others.
260
+
261
+ 66
262
+ 00:05:22,000 --> 00:05:28,000
263
+ And if you would ask me to come up with even simple definition, I would say is its primary key is a
264
+
265
+ 67
266
+ 00:05:28,000 --> 00:05:29,000
267
+ unique idea.
268
+
269
+ 68
270
+ 00:05:30,000 --> 00:05:35,000
271
+ We are going to build a relationship between tables and being more specific.
272
+
273
+ 69
274
+ 00:05:35,000 --> 00:05:41,000
275
+ We would build relationships with the two in one table with data in another table.
276
+
277
+ 70
278
+ 00:05:41,000 --> 00:05:49,000
279
+ That means we need to find a way to uniquely identify each role in each table to connect them between
280
+
281
+ 71
282
+ 00:05:49,000 --> 00:05:49,000
283
+ each other.
284
+
285
+ 72
286
+ 00:05:50,000 --> 00:05:53,000
287
+ That's why primary key is so important.
288
+
289
+ 73
290
+ 00:05:53,000 --> 00:05:56,000
291
+ Let's come up with the ideas of primary key.
292
+
293
+ 74
294
+ 00:05:57,000 --> 00:06:03,000
295
+ The first goal is to uniquely identify to people in the database table, and the second goal is to ensure
296
+
297
+ 75
298
+ 00:06:03,000 --> 00:06:04,000
299
+ connection between tables.
300
+
301
+ 76
302
+ 00:06:05,000 --> 00:06:06,000
303
+ Is that clear?
304
+
305
+ 77
306
+ 00:06:06,000 --> 00:06:13,000
307
+ And always remember that in case of any questions exam, you can put your question below this reader
308
+
309
+ 78
310
+ 00:06:13,000 --> 00:06:15,000
311
+ and I will be happy to answer it.
312
+
313
+ 79
314
+ 00:06:16,000 --> 00:06:23,000
315
+ But how to choose the primary key, among other attributes, what rules should be applied or what is
316
+
317
+ 80
318
+ 00:06:23,000 --> 00:06:30,000
319
+ the best practices zero of some is to select the shortest possible field if you understand what I mean.
320
+
321
+ 81
322
+ 00:06:30,000 --> 00:06:33,000
323
+ What's the shortest possible combination of fields?
324
+
325
+ 82
326
+ 00:06:33,000 --> 00:06:36,000
327
+ By saying this, I pursue one goal.
328
+
329
+ 83
330
+ 00:06:36,000 --> 00:06:39,000
331
+ Primary key should be simple enough to work.
332
+
333
+ 84
334
+ 00:06:39,000 --> 00:06:44,000
335
+ It should be atomic and shouldn't consist from multiple values inside one field.
336
+
337
+ 85
338
+ 00:06:45,000 --> 00:06:50,000
339
+ It should be unique, and achieving this uniqueness shouldn't be hard thing to do.
340
+
341
+ 86
342
+ 00:06:51,000 --> 00:06:58,000
343
+ I mean is easy to find, not unique first name, and it is impossible to find the same email.
344
+
345
+ 87
346
+ 00:06:58,000 --> 00:07:05,000
347
+ That means that achieving uniqueness for email field is more simple, and it is better option to use
348
+
349
+ 88
350
+ 00:07:05,000 --> 00:07:06,000
351
+ for primary key.
352
+
353
+ 89
354
+ 00:07:06,000 --> 00:07:10,000
355
+ And obviously, primary key can't be no value.
356
+
357
+ 90
358
+ 00:07:11,000 --> 00:07:12,000
359
+ To send my point.
360
+
361
+ 91
362
+ 00:07:13,000 --> 00:07:21,000
363
+ Another important classification is its primary key may be simple and compound interest and in simple
364
+
365
+ 92
366
+ 00:07:21,000 --> 00:07:25,000
367
+ words, simple primary key consists of the one people felt.
368
+
369
+ 93
370
+ 00:07:25,000 --> 00:07:34,000
371
+ This can be an email I the best for no or anything else what is unique for each row in table and fits
372
+
373
+ 94
374
+ 00:07:34,000 --> 00:07:35,000
375
+ in one field?
376
+
377
+ 95
378
+ 00:07:36,000 --> 00:07:44,000
379
+ On the other hand, Compound's primary key consists of two or more fields, so the combination of these
380
+
381
+ 96
382
+ 00:07:44,000 --> 00:07:46,000
383
+ fields should be unique.
384
+
385
+ 97
386
+ 00:07:47,000 --> 00:07:54,000
387
+ For example, I have online courses and each course has I.D. That is, of course, primary key.
388
+
389
+ 98
390
+ 00:07:54,000 --> 00:08:01,000
391
+ Also, I have students and each student has its own unique identifier, and let's imagine that I need
392
+
393
+ 99
394
+ 00:08:01,000 --> 00:08:04,000
395
+ to store information about enrollments.
396
+
397
+ 100
398
+ 00:08:04,000 --> 00:08:12,000
399
+ In my course, I have an enrollment table that has Compound's primary key that consists of two values,
400
+
401
+ 101
402
+ 00:08:12,000 --> 00:08:21,000
403
+ namely courses plus student I.D. And there is information that people like the date of enrollment,
404
+
405
+ 102
406
+ 00:08:21,000 --> 00:08:29,000
407
+ growth, speed, discount applied or any other possible field can be easily connected and identified
408
+
409
+ 103
410
+ 00:08:29,000 --> 00:08:31,000
411
+ with this compound primary key.
412
+
413
+ 104
414
+ 00:08:31,000 --> 00:08:32,000
415
+ Does it make sense?
416
+
417
+ 105
418
+ 00:08:33,000 --> 00:08:39,000
419
+ To be honest, Compound's primary keys are less often than simple primary kiss.
420
+
421
+ 106
422
+ 00:08:39,000 --> 00:08:47,000
423
+ But still they exist, and I'm going to teach you how to create compounds primary keys in the database.
424
+
425
+ 107
426
+ 00:08:47,000 --> 00:08:50,000
427
+ In a separate lesson, you're in the practice exercise.
428
+
429
+ 108
430
+ 00:08:51,000 --> 00:08:55,000
431
+ And that's the classification of primary key depends on its origins.
432
+
433
+ 109
434
+ 00:08:56,000 --> 00:09:04,000
435
+ Primary key may be natural a surrogate surrogate primary keys also called synthetic, sometimes in simple
436
+
437
+ 110
438
+ 00:09:04,000 --> 00:09:05,000
439
+ words, is a natural primary.
440
+
441
+ 111
442
+ 00:09:05,000 --> 00:09:09,000
443
+ Key is a field that stores useful information.
444
+
445
+ 112
446
+ 00:09:09,000 --> 00:09:14,000
447
+ For example, desperate number may be unique for a person, but this is also values.
448
+
449
+ 113
450
+ 00:09:14,000 --> 00:09:18,000
451
+ It contains information related to specific person.
452
+
453
+ 114
454
+ 00:09:18,000 --> 00:09:19,000
455
+ This is real.
456
+
457
+ 115
458
+ 00:09:19,000 --> 00:09:24,000
459
+ Data is accurate naturally, and just records the same situation with email.
460
+
461
+ 116
462
+ 00:09:25,000 --> 00:09:28,000
463
+ Email may be considered as national primary key.
464
+
465
+ 117
466
+ 00:09:29,000 --> 00:09:32,000
467
+ National keys have one logical advantage, in my opinion.
468
+
469
+ 118
470
+ 00:09:32,000 --> 00:09:35,000
471
+ It sounds like this is it the search.
472
+
473
+ 119
474
+ 00:09:36,000 --> 00:09:42,000
475
+ Since Natural Ki contains some valuable information, it is easier for you to understand this information.
476
+
477
+ 120
478
+ 00:09:42,000 --> 00:09:49,000
479
+ For example, it will be hard to remember sequence number for each user to search user, but it's the
480
+
481
+ 121
482
+ 00:09:49,000 --> 00:09:56,000
483
+ but instead it will be easier to memorize user email and search user by its email.
484
+
485
+ 122
486
+ 00:09:56,000 --> 00:10:04,000
487
+ Natural primary keys have some disadvantages, though the most important are take more memory to store
488
+
489
+ 123
490
+ 00:10:04,000 --> 00:10:06,000
491
+ rather than surrogate key.
492
+
493
+ 124
494
+ 00:10:07,000 --> 00:10:14,000
495
+ This means that you will require more memory to store the data, and also this means is a joint request
496
+
497
+ 125
498
+ 00:10:14,000 --> 00:10:22,000
499
+ on multiple tables might take more time because usually natural keys are strings but not integers,
500
+
501
+ 126
502
+ 00:10:22,000 --> 00:10:25,000
503
+ and it takes time to compare strings.
504
+
505
+ 127
506
+ 00:10:26,000 --> 00:10:29,000
507
+ Requires cascading update in case of changing.
508
+
509
+ 128
510
+ 00:10:29,000 --> 00:10:38,000
511
+ Imagine that you use email as a primary key and user decided to change email, we forbid him to do so.
512
+
513
+ 129
514
+ 00:10:39,000 --> 00:10:40,000
515
+ Of course not.
516
+
517
+ 130
518
+ 00:10:40,000 --> 00:10:42,000
519
+ He changes email.
520
+
521
+ 131
522
+ 00:10:42,000 --> 00:10:49,000
523
+ After that, we have to update email everywhere where we used his primary key to build relationships
524
+
525
+ 132
526
+ 00:10:50,000 --> 00:10:52,000
527
+ basically in other tables.
528
+
529
+ 133
530
+ 00:10:52,000 --> 00:10:59,000
531
+ Definitely, this operation will take some time dependent on a number of changes that we have to make.
532
+
533
+ 134
534
+ 00:11:00,000 --> 00:11:03,000
535
+ But why should we do these cascading changes?
536
+
537
+ 135
538
+ 00:11:03,000 --> 00:11:10,000
539
+ If we could avoid doing them at all and one more problems that you might face with while using natural
540
+
541
+ 136
542
+ 00:11:10,000 --> 00:11:16,000
543
+ key, there might be cases when you just don't have all the necessary information all the time.
544
+
545
+ 137
546
+ 00:11:16,000 --> 00:11:21,000
547
+ Imagine that in the application, you also supports registration with a phone number.
548
+
549
+ 138
550
+ 00:11:22,000 --> 00:11:29,000
551
+ User can choose whether he or she wants to use phone number or email for authorization.
552
+
553
+ 139
554
+ 00:11:29,000 --> 00:11:31,000
555
+ And what should we do in this case?
556
+
557
+ 140
558
+ 00:11:32,000 --> 00:11:33,000
559
+ It is hard to answer.
560
+
561
+ 141
562
+ 00:11:33,000 --> 00:11:40,000
563
+ You would have to come up with some email that you don't have in order to fill out the primary key.
564
+
565
+ 142
566
+ 00:11:40,000 --> 00:11:46,000
567
+ And what will happen when you start sending you say that you are going to send an email to the false
568
+
569
+ 143
570
+ 00:11:46,000 --> 00:11:47,000
571
+ address?
572
+
573
+ 144
574
+ 00:11:47,000 --> 00:11:54,000
575
+ Well, the see what problems may appear to address all issues mentioned above.
576
+
577
+ 145
578
+ 00:11:54,000 --> 00:11:56,000
579
+ You can just use surrogate key.
580
+
581
+ 146
582
+ 00:11:57,000 --> 00:12:04,000
583
+ On the contrary to natural case surrogates, kid doesn't have a natural relationship with the rest data
584
+
585
+ 147
586
+ 00:12:04,000 --> 00:12:05,000
587
+ in the record.
588
+
589
+ 148
590
+ 00:12:05,000 --> 00:12:13,000
591
+ That's why, no matter how records will change, your surrogate key will stay the same because its only
592
+
593
+ 149
594
+ 00:12:13,000 --> 00:12:17,000
595
+ goal is to identify records in the table.
596
+
597
+ 150
598
+ 00:12:17,000 --> 00:12:19,000
599
+ That's it, and nothing more.
600
+
601
+ 151
602
+ 00:12:20,000 --> 00:12:27,000
603
+ Usually, this is integer value that is incremented with each new row, and you are not Borsa at Wiscasset
604
+
605
+ 152
606
+ 00:12:27,000 --> 00:12:31,000
607
+ in need or thinking about any false value.
608
+
609
+ 153
610
+ 00:12:31,000 --> 00:12:36,000
611
+ I recommend it to use surrogate keys, but this will be only up to you.
612
+
613
+ 154
614
+ 00:12:36,000 --> 00:12:41,000
615
+ Summarizing limbo, let's come up with advantages of surrogates.
616
+
617
+ 155
618
+ 00:12:41,000 --> 00:12:47,000
619
+ Case surrogate Qi has no any business related information built in it.
620
+
621
+ 156
622
+ 00:12:47,000 --> 00:12:50,000
623
+ This makes sinks easier.
624
+
625
+ 157
626
+ 00:12:50,000 --> 00:12:54,000
627
+ We shouldn't worry about updating it in all related tables.
628
+
629
+ 158
630
+ 00:12:55,000 --> 00:13:01,000
631
+ Performing cascading operations in case some business related information from primary key has been
632
+
633
+ 159
634
+ 00:13:01,000 --> 00:13:02,000
635
+ changed.
636
+
637
+ 160
638
+ 00:13:02,000 --> 00:13:10,000
639
+ Also, this type of case takes less memory because usually we use integer time for surrogate keys,
640
+
641
+ 161
642
+ 00:13:10,000 --> 00:13:12,000
643
+ and this is only four bytes.
644
+
645
+ 162
646
+ 00:13:12,000 --> 00:13:17,000
647
+ Usually, requests on different tables also completed faster.
648
+
649
+ 163
650
+ 00:13:17,000 --> 00:13:23,000
651
+ Usually, there are no reasons to change surrogate qi because it is just and then the fire.
652
+
653
+ 164
654
+ 00:13:24,000 --> 00:13:29,000
655
+ Thus, there is no need in cascading need of the value in all related tables.
656
+
657
+ 165
658
+ 00:13:30,000 --> 00:13:37,000
659
+ And the only drawback is that I see in using surrogate integer key is that it can limit the number of
660
+
661
+ 166
662
+ 00:13:37,000 --> 00:13:43,000
663
+ rows in the table because at the end of the day, we have limited amount of memory reserved for data
664
+
665
+ 167
666
+ 00:13:43,000 --> 00:13:47,000
667
+ of integer type that is four bytes only.
668
+
669
+ 168
670
+ 00:13:47,000 --> 00:13:52,000
671
+ But on the other hand, you can use unsigned integer value.
672
+
673
+ 169
674
+ 00:13:53,000 --> 00:13:59,000
675
+ This gives you opportunity to use one low need to store additional information, and in total, you
676
+
677
+ 170
678
+ 00:13:59,000 --> 00:14:02,000
679
+ can create more than four billion the rules.
680
+
681
+ 171
682
+ 00:14:03,000 --> 00:14:08,000
683
+ And believe me, if you have more than four million records in your table, you're going to have a lot
684
+
685
+ 172
686
+ 00:14:08,000 --> 00:14:11,000
687
+ of other problems besides limit of integer value.
688
+
689
+ 173
690
+ 00:14:12,000 --> 00:14:18,000
691
+ And if you have four billion users registered in your app, you have enough resources to apply workarounds
692
+
693
+ 174
694
+ 00:14:18,000 --> 00:14:18,000
695
+ for this issue.
696
+
697
+ 175
698
+ 00:14:19,000 --> 00:14:24,000
699
+ One was a solution, maybe is to create table was big and start for primary care.
700
+
701
+ 176
702
+ 00:14:25,000 --> 00:14:30,000
703
+ This data type use eight bytes to store information, which should be enough.
704
+
705
+ 177
706
+ 00:14:31,000 --> 00:14:37,000
707
+ And after that, you can copy and paste rows from one table to another and update the last tidy value
708
+
709
+ 178
710
+ 00:14:37,000 --> 00:14:42,000
711
+ for all the increment in order you can proceed, adding new ideas for new records.
712
+
713
+ 179
714
+ 00:14:43,000 --> 00:14:48,000
715
+ Don't worry, I'm going to show you how to do this on practice in the following lessons.
716
+
717
+ 180
718
+ 00:14:49,000 --> 00:14:54,000
719
+ We already know what's primary case and learned different classifications of primary case.
720
+
721
+ 181
722
+ 00:14:55,000 --> 00:15:04,000
723
+ Now let me explain what alternate care is there also called sometimes secondary case alternate case
724
+
725
+ 182
726
+ 00:15:04,000 --> 00:15:11,000
727
+ as those candidates case, which are not the primary care since there's only one primary care for a
728
+
729
+ 183
730
+ 00:15:11,000 --> 00:15:11,000
731
+ table.
732
+
733
+ 184
734
+ 00:15:11,000 --> 00:15:19,000
735
+ Other fields that are also unique and can be used for Typekit identification are called alternate case.
736
+
737
+ 185
738
+ 00:15:19,000 --> 00:15:25,000
739
+ For example, imagine that you have table was users and you decided to use surrogate primary care,
740
+
741
+ 186
742
+ 00:15:25,000 --> 00:15:29,000
743
+ but you also have another column that contains only unique values.
744
+
745
+ 187
746
+ 00:15:30,000 --> 00:15:33,000
747
+ It can be common with emails, for example.
748
+
749
+ 188
750
+ 00:15:33,000 --> 00:15:38,000
751
+ Indeed, it is impossible that users will have the same email the system.
752
+
753
+ 189
754
+ 00:15:39,000 --> 00:15:43,000
755
+ But database administrator decided to use it as a primary key.
756
+
757
+ 190
758
+ 00:15:44,000 --> 00:15:51,000
759
+ We unique restriction to a mail column and still can use it to extract user when needed.
760
+
761
+ 191
762
+ 00:15:51,000 --> 00:15:55,000
763
+ But this attribute may be considered as an alternate care.
764
+
765
+ 192
766
+ 00:15:55,000 --> 00:15:56,000
767
+ Is that clear?
768
+
769
+ 193
770
+ 00:15:57,000 --> 00:15:59,000
771
+ Now let's look at another important term.
772
+
773
+ 194
774
+ 00:15:59,000 --> 00:16:02,000
775
+ Let me explain what foreign key is.
776
+
777
+ 195
778
+ 00:16:02,000 --> 00:16:09,000
779
+ One key is an attribute which is primary key in its parent table, but is included as an action.
780
+
781
+ 196
782
+ 00:16:09,000 --> 00:16:16,000
783
+ But in another table with the goal to establish connection between entities, we already know that in
784
+
785
+ 197
786
+ 00:16:16,000 --> 00:16:24,000
787
+ relational database we may have different tables and tables will be connected with each other to avoid
788
+
789
+ 198
790
+ 00:16:24,000 --> 00:16:30,000
791
+ data duplication and to ensure the most efficient and consistent data storage neutrally.
792
+
793
+ 199
794
+ 00:16:30,000 --> 00:16:36,000
795
+ In the minute, you're going to see examples how relationships between different tables are established.
796
+
797
+ 200
798
+ 00:16:37,000 --> 00:16:40,000
799
+ So now you know what primary key and foreign key is.
800
+
801
+ 201
802
+ 00:16:41,000 --> 00:16:47,000
803
+ That means we can learn type of relationships and understand technical side of establishing connections
804
+
805
+ 202
806
+ 00:16:47,000 --> 00:16:48,000
807
+ between tables.
808
+
809
+ 203
810
+ 00:16:49,000 --> 00:16:52,000
811
+ First of all, let's understand what relationship is.
812
+
813
+ 204
814
+ 00:16:53,000 --> 00:17:00,000
815
+ There is a definition from a relational database theory that was defined by Edgar Frankel, inventor
816
+
817
+ 205
818
+ 00:17:00,000 --> 00:17:03,000
819
+ of relational model database management.
820
+
821
+ 206
822
+ 00:17:03,000 --> 00:17:09,000
823
+ But instead of reading that definition, I'm going to explain you what relationship is, in simple words,
824
+
825
+ 207
826
+ 00:17:10,000 --> 00:17:16,000
827
+ relationship in a relational database management system using an association of records from two or
828
+
829
+ 208
830
+ 00:17:16,000 --> 00:17:17,000
831
+ more tables.
832
+
833
+ 209
834
+ 00:17:18,000 --> 00:17:23,000
835
+ Let me also explain the relationship on example from real life user has a car.
836
+
837
+ 210
838
+ 00:17:24,000 --> 00:17:30,000
839
+ This is a relationship between the user of the car and dependent on the number of objects from each
840
+
841
+ 211
842
+ 00:17:30,000 --> 00:17:31,000
843
+ side of this relationship.
844
+
845
+ 212
846
+ 00:17:32,000 --> 00:17:35,000
847
+ Then different types of relationship is that clear.
848
+
849
+ 213
850
+ 00:17:36,000 --> 00:17:39,000
851
+ In the relational database, there are three types of relationships.
852
+
853
+ 214
854
+ 00:17:40,000 --> 00:17:42,000
855
+ They are one to many.
856
+
857
+ 215
858
+ 00:17:43,000 --> 00:17:48,000
859
+ That is when one user math many cars matter to many.
860
+
861
+ 216
862
+ 00:17:48,000 --> 00:17:57,000
863
+ One user may have a lot of cars and one car may be owned by two users, by two co-owners and one to
864
+
865
+ 217
866
+ 00:17:57,000 --> 00:17:58,000
867
+ one.
868
+
869
+ 218
870
+ 00:17:58,000 --> 00:18:03,000
871
+ This relationship one one user can own one car only.
872
+
873
+ 219
874
+ 00:18:04,000 --> 00:18:10,000
875
+ And now I'd like you to understand each of these relationship types, one by one in details, we'll
876
+
877
+ 220
878
+ 00:18:10,000 --> 00:18:13,000
879
+ try to understand that logical first.
880
+
881
+ 221
882
+ 00:18:13,000 --> 00:18:20,000
883
+ And after that, I will provide technical explanation on how this is implemented on database level one
884
+
885
+ 222
886
+ 00:18:20,000 --> 00:18:27,000
887
+ to many means that one object from one table may be related to many objects from another table.
888
+
889
+ 223
890
+ 00:18:28,000 --> 00:18:31,000
891
+ Now, a particular example was user and car.
892
+
893
+ 224
894
+ 00:18:31,000 --> 00:18:34,000
895
+ We can apply want the money relationship in the next week?
896
+
897
+ 225
898
+ 00:18:34,000 --> 00:18:40,000
899
+ One user may own multiple cars, but each car has only one user.
900
+
901
+ 226
902
+ 00:18:41,000 --> 00:18:43,000
903
+ This is equal to one to many relationship.
904
+
905
+ 227
906
+ 00:18:44,000 --> 00:18:46,000
907
+ One user owning many cars.
908
+
909
+ 228
910
+ 00:18:46,000 --> 00:18:47,000
911
+ Does it make sense?
912
+
913
+ 229
914
+ 00:18:48,000 --> 00:18:53,000
915
+ If you understood it logically, let's learn how this is implemented on database level.
916
+
917
+ 230
918
+ 00:18:54,000 --> 00:19:01,000
919
+ Each relationship is implemented by migration of primary care from parent table in the direction of
920
+
921
+ 231
922
+ 00:19:01,000 --> 00:19:01,000
923
+ another table.
924
+
925
+ 232
926
+ 00:19:02,000 --> 00:19:07,000
927
+ The fields that we received after this migration is called foreign key.
928
+
929
+ 233
930
+ 00:19:08,000 --> 00:19:11,000
931
+ In this example, we have table user and table car.
932
+
933
+ 234
934
+ 00:19:12,000 --> 00:19:16,000
935
+ We add new column and table car that is called user I.D..
936
+
937
+ 235
938
+ 00:19:17,000 --> 00:19:23,000
939
+ This will be a column as a source for Enki and for each car of specific user.
940
+
941
+ 236
942
+ 00:19:24,000 --> 00:19:29,000
943
+ We pulled his I.D. and that's it was successfully established relationship.
944
+
945
+ 237
946
+ 00:19:30,000 --> 00:19:33,000
947
+ Now you can query these two tables together.
948
+
949
+ 238
950
+ 00:19:33,000 --> 00:19:42,000
951
+ For example, your query may sound like this return we can manufacture of each car that belongs to the
952
+
953
+ 239
954
+ 00:19:42,000 --> 00:19:50,000
955
+ user was a new one and user email, and you have enough information to map records from two tables between
956
+
957
+ 240
958
+ 00:19:50,000 --> 00:19:51,000
959
+ each other.
960
+
961
+ 241
962
+ 00:19:52,000 --> 00:19:53,000
963
+ Do you understand?
964
+
965
+ 242
966
+ 00:19:54,000 --> 00:20:00,000
967
+ In our sequel lesson, I will teach you how to grade school queries to retrieve this kind of information.
968
+
969
+ 243
970
+ 00:20:01,000 --> 00:20:03,000
971
+ But is it clear for you, at least on the high level?
972
+
973
+ 244
974
+ 00:20:04,000 --> 00:20:11,000
975
+ Remember, understanding the concept is much more important rather than understanding of detailed query,
976
+
977
+ 245
978
+ 00:20:11,000 --> 00:20:18,000
979
+ because syntax of sequel is something you can always learn and something what you can always find on
980
+
981
+ 246
982
+ 00:20:18,000 --> 00:20:19,000
983
+ the internet.
984
+
985
+ 247
986
+ 00:20:19,000 --> 00:20:27,000
987
+ But deep understanding this assumption was belongs only to you and can be found in the internet.
988
+
989
+ 248
990
+ 00:20:27,000 --> 00:20:34,000
991
+ So I suppose for a minute, if needed to understand this, once you feel sure that you understood this.
992
+
993
+ 249
994
+ 00:20:34,000 --> 00:20:35,000
995
+ Let's proceed.
996
+
997
+ 250
998
+ 00:20:36,000 --> 00:20:43,000
999
+ On the dining room, we usually mark this relationship with asterisk and one digit asterisk stands for
1000
+
1001
+ 251
1002
+ 00:20:43,000 --> 00:20:44,000
1003
+ many.
1004
+
1005
+ 252
1006
+ 00:20:44,000 --> 00:20:46,000
1007
+ And one stands for one.
1008
+
1009
+ 253
1010
+ 00:20:47,000 --> 00:20:50,000
1011
+ Again, one user and many cars.
1012
+
1013
+ 254
1014
+ 00:20:50,000 --> 00:20:52,000
1015
+ Each car has only one user.
1016
+
1017
+ 255
1018
+ 00:20:53,000 --> 00:21:00,000
1019
+ One more thing in case you are going to use object, relational map and framework in your programming
1020
+
1021
+ 256
1022
+ 00:21:00,000 --> 00:21:06,000
1023
+ language, you may find that sometimes there is a difference between one to many and many to one relationship.
1024
+
1025
+ 257
1026
+ 00:21:07,000 --> 00:21:15,000
1027
+ Basically, these are the same relationship types, but the difference in what is read here in the current
1028
+
1029
+ 258
1030
+ 00:21:15,000 --> 00:21:22,000
1031
+ object between the related other objects, for example, in the same case, relationship will be named
1032
+
1033
+ 259
1034
+ 00:21:22,000 --> 00:21:30,000
1035
+ one to many in the user entity, and it will be managed to one incur entity do feel the difference.
1036
+
1037
+ 260
1038
+ 00:21:31,000 --> 00:21:31,000
1039
+ That's great.
1040
+
1041
+ 261
1042
+ 00:21:32,000 --> 00:21:32,000
1043
+ Let's move on.
1044
+
1045
+ 262
1046
+ 00:21:34,000 --> 00:21:40,000
1047
+ And the next relationship that we are going to review today is managed to manage this kind of relationship
1048
+
1049
+ 263
1050
+ 00:21:40,000 --> 00:21:47,000
1051
+ defiance as a situation when one records from one table may be connected to as many records from another
1052
+
1053
+ 264
1054
+ 00:21:47,000 --> 00:21:52,000
1055
+ table and one records from another table may be connected to as many records from the first table.
1056
+
1057
+ 265
1058
+ 00:21:53,000 --> 00:21:56,000
1059
+ I can say that many to many relationship.
1060
+
1061
+ 266
1062
+ 00:21:56,000 --> 00:22:02,000
1063
+ It is also humans name, and technically this is just too one.
1064
+
1065
+ 267
1066
+ 00:22:02,000 --> 00:22:07,000
1067
+ Too many relationships implemented in two directions doesn't make sense.
1068
+
1069
+ 268
1070
+ 00:22:08,000 --> 00:22:11,000
1071
+ Let's try to understand how to implement this.
1072
+
1073
+ 269
1074
+ 00:22:11,000 --> 00:22:14,000
1075
+ Imagine that we have students and different courses.
1076
+
1077
+ 270
1078
+ 00:22:15,000 --> 00:22:22,000
1079
+ Each student may enroll in multiple courses, and basically each course may ask multiple students.
1080
+
1081
+ 271
1082
+ 00:22:22,000 --> 00:22:30,000
1083
+ We have bidirectional one to many relationship between these two tables or, in other words, many too
1084
+
1085
+ 272
1086
+ 00:22:30,000 --> 00:22:31,000
1087
+ many.
1088
+
1089
+ 273
1090
+ 00:22:31,000 --> 00:22:39,000
1091
+ In this case, we can't just put foreign key into tables because we need to build many relationships
1092
+
1093
+ 274
1094
+ 00:22:39,000 --> 00:22:45,000
1095
+ on one side and many relationships for each record on another side.
1096
+
1097
+ 275
1098
+ 00:22:45,000 --> 00:22:50,000
1099
+ So technically, this is impossible to do with two tables only.
1100
+
1101
+ 276
1102
+ 00:22:51,000 --> 00:22:56,000
1103
+ That's why to organize money into money relationships between two tables when it degrades a set table.
1104
+
1105
+ 277
1106
+ 00:22:57,000 --> 00:23:05,000
1107
+ This table will contain foreign keys from one and the second tables and will map them between each other.
1108
+
1109
+ 278
1110
+ 00:23:06,000 --> 00:23:13,000
1111
+ In this particular case, each student was I.D. one in the world, and some course we map these, of
1112
+
1113
+ 279
1114
+ 00:23:13,000 --> 00:23:16,000
1115
+ course, and student in the SEC table.
1116
+
1117
+ 280
1118
+ 00:23:16,000 --> 00:23:21,000
1119
+ And even this course has also students was I need to hand suite.
1120
+
1121
+ 281
1122
+ 00:23:21,000 --> 00:23:25,000
1123
+ We also specify this in the table here.
1124
+
1125
+ 282
1126
+ 00:23:25,000 --> 00:23:31,000
1127
+ We have Compound's primary key combination of these two fields has to be unique in each step.
1128
+
1129
+ 283
1130
+ 00:23:32,000 --> 00:23:38,000
1131
+ Regarding naming convention for such tables, it depends on the final purpose of this table.
1132
+
1133
+ 284
1134
+ 00:23:38,000 --> 00:23:45,000
1135
+ If we just want to establish connection between two entities, then we can use and the two names and
1136
+
1137
+ 285
1138
+ 00:23:45,000 --> 00:23:48,000
1139
+ the verb that describes connection between them.
1140
+
1141
+ 286
1142
+ 00:23:48,000 --> 00:23:56,000
1143
+ In this case, we can names a stable student has course or even should a student course, in case we
1144
+
1145
+ 287
1146
+ 00:23:56,000 --> 00:24:04,000
1147
+ would add another business related info in each sample like date of enrollment, price information about
1148
+
1149
+ 288
1150
+ 00:24:04,000 --> 00:24:09,000
1151
+ discounts and in case we're going to operate with this entity, as was a separate one.
1152
+
1153
+ 289
1154
+ 00:24:10,000 --> 00:24:17,000
1155
+ In this case, we can give some business variable name to this table, for example, enrollment is that
1156
+
1157
+ 290
1158
+ 00:24:17,000 --> 00:24:18,000
1159
+ clear.
1160
+
1161
+ 291
1162
+ 00:24:19,000 --> 00:24:22,000
1163
+ And we have one more type of relationship to discuss.
1164
+
1165
+ 292
1166
+ 00:24:23,000 --> 00:24:25,000
1167
+ I'm talking about one to one relationship.
1168
+
1169
+ 293
1170
+ 00:24:25,000 --> 00:24:29,000
1171
+ This is the rarest type of relationship, to be honest.
1172
+
1173
+ 294
1174
+ 00:24:29,000 --> 00:24:36,000
1175
+ Based on my experience, you would face was one too many and many, too many relationships more often
1176
+
1177
+ 295
1178
+ 00:24:36,000 --> 00:24:38,000
1179
+ than was one to one.
1180
+
1181
+ 296
1182
+ 00:24:38,000 --> 00:24:45,000
1183
+ Because this type of relationship describes very specific business case one one records in one table
1184
+
1185
+ 297
1186
+ 00:24:45,000 --> 00:24:49,000
1187
+ is related with only one record from another table.
1188
+
1189
+ 298
1190
+ 00:24:49,000 --> 00:24:52,000
1191
+ Can you think of cases like this?
1192
+
1193
+ 299
1194
+ 00:24:52,000 --> 00:24:53,000
1195
+ It is hard to do.
1196
+
1197
+ 300
1198
+ 00:24:53,000 --> 00:24:54,000
1199
+ Is that preparation?
1200
+
1201
+ 301
1202
+ 00:24:55,000 --> 00:24:56,000
1203
+ And I can understand you.
1204
+
1205
+ 302
1206
+ 00:24:57,000 --> 00:25:00,000
1207
+ I come up with some example for this type of relationship.
1208
+
1209
+ 303
1210
+ 00:25:01,000 --> 00:25:06,000
1211
+ Imagine one transaction and you have table was all transactions in that.
1212
+
1213
+ 304
1214
+ 00:25:07,000 --> 00:25:09,000
1215
+ And also there is transaction info table.
1216
+
1217
+ 305
1218
+ 00:25:10,000 --> 00:25:13,000
1219
+ There is more detailed information about each transaction.
1220
+
1221
+ 306
1222
+ 00:25:13,000 --> 00:25:19,000
1223
+ And it also stores sensitive information, and not all the users can read it.
1224
+
1225
+ 307
1226
+ 00:25:19,000 --> 00:25:25,000
1227
+ That's why there is a need to store some attributes and values in secure table.
1228
+
1229
+ 308
1230
+ 00:25:26,000 --> 00:25:32,000
1231
+ But still, there is a connection between these two tables, and each transaction is connected with
1232
+
1233
+ 309
1234
+ 00:25:32,000 --> 00:25:36,000
1235
+ only one recording transaction in a table and vice versa.
1236
+
1237
+ 310
1238
+ 00:25:37,000 --> 00:25:42,000
1239
+ Each transaction infrared connected to only one transaction.
1240
+
1241
+ 311
1242
+ 00:25:42,000 --> 00:25:48,000
1243
+ To implement this connection, you can use two strategies you can use a use share key.
1244
+
1245
+ 312
1246
+ 00:25:48,000 --> 00:25:56,000
1247
+ That means that the primary key in one table is equal to primary key in another table, or you can create
1248
+
1249
+ 313
1250
+ 00:25:56,000 --> 00:26:02,000
1251
+ joint column and declare field where primary key will be exported in the table.
1252
+
1253
+ 314
1254
+ 00:26:03,000 --> 00:26:09,000
1255
+ Most options are good in this case because they allow you to build the relationship between two tables.
1256
+
1257
+ 315
1258
+ 00:26:10,000 --> 00:26:18,000
1259
+ I would just put a stress one more time on the fact that so many cases for one to one relationship heaven,
1260
+
1261
+ 316
1262
+ 00:26:18,000 --> 00:26:24,000
1263
+ one to one relationship without clear argumentation is an indicator of pure database design.
1264
+
1265
+ 317
1266
+ 00:26:25,000 --> 00:26:28,000
1267
+ That's all what I wanted to share with you in this lesson.
1268
+
1269
+ 318
1270
+ 00:26:29,000 --> 00:26:36,000
1271
+ Now let's recap what we have learned today in this lesson of the grant basic terms in the relational
1272
+
1273
+ 319
1274
+ 00:26:36,000 --> 00:26:37,000
1275
+ databases.
1276
+
1277
+ 320
1278
+ 00:26:37,000 --> 00:26:43,000
1279
+ Now, you know the difference between such terms as database and schema you used in details of what
1280
+
1281
+ 321
1282
+ 00:26:43,000 --> 00:26:45,000
1283
+ primary care is.
1284
+
1285
+ 322
1286
+ 00:26:45,000 --> 00:26:52,000
1287
+ Also, we have learned different classifications of primary keys, such as single and compound, natural
1288
+
1289
+ 323
1290
+ 00:26:52,000 --> 00:26:53,000
1291
+ and surrogate.
1292
+
1293
+ 324
1294
+ 00:26:54,000 --> 00:26:59,000
1295
+ I explained to you what Ultimate Kit is after that.
1296
+
1297
+ 325
1298
+ 00:26:59,000 --> 00:27:03,000
1299
+ We learned such an important concept in relational database as foreign key.
1300
+
1301
+ 326
1302
+ 00:27:04,000 --> 00:27:08,000
1303
+ And at the end of the lesson, we've got three main types of relationship.
1304
+
1305
+ 327
1306
+ 00:27:09,000 --> 00:27:15,000
1307
+ Now, you know the difference between one of the many, many too many and one to one relationships.
1308
+
1309
+ 328
1310
+ 00:27:16,000 --> 00:27:17,000
1311
+ Thanks a lot for your attention, team.
1312
+
1313
+ 329
1314
+ 00:27:18,000 --> 00:27:19,000
1315
+ Have a great day.
1316
+
1317
+ 330
1318
+ 00:27:19,000 --> 00:27:20,000
1319
+ See you in the next lesson.
1320
+
47 - Relational databases/002 Create Schema & Table Naming, Collation, Engines, Types, Column Properties_en.srt ADDED
@@ -0,0 +1,1888 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:06,000 --> 00:00:07,000
3
+ Hello came by this moment.
4
+
5
+ 2
6
+ 00:00:07,000 --> 00:00:12,000
7
+ Now, of course, you already have some surgical knowledge about the relational databases.
8
+
9
+ 3
10
+ 00:00:12,000 --> 00:00:16,000
11
+ And in this lesson, we're going to have more practice activities.
12
+
13
+ 4
14
+ 00:00:17,000 --> 00:00:22,000
15
+ This lesson will be dedicated to learning of basic operations with database management system.
16
+
17
+ 5
18
+ 00:00:23,000 --> 00:00:26,000
19
+ We are going to create schema and table in database.
20
+
21
+ 6
22
+ 00:00:26,000 --> 00:00:30,000
23
+ And as we go, we'll learn a lot of interest in sinks.
24
+
25
+ 7
26
+ 00:00:31,000 --> 00:00:36,000
27
+ We're going to have super interesting lessons because we'll start from practice activities.
28
+
29
+ 8
30
+ 00:00:36,000 --> 00:00:41,000
31
+ And we're going to learn just enough series to achieve all of the lessons learned.
32
+
33
+ 9
34
+ 00:00:41,000 --> 00:00:44,000
35
+ The lesson will perform operations in my school workbench.
36
+
37
+ 10
38
+ 00:00:44,000 --> 00:00:48,000
39
+ And you will gradually start learning it step by step.
40
+
41
+ 11
42
+ 00:00:48,000 --> 00:00:54,000
43
+ I would explain you what main buttons are and that will hold a live demo was explaining off each step
44
+
45
+ 12
46
+ 00:00:54,000 --> 00:00:55,000
47
+ that I'm doing.
48
+
49
+ 13
50
+ 00:00:56,000 --> 00:01:02,000
51
+ The main goal of the course in general and this lesson in particular, is orientation on skills that
52
+
53
+ 14
54
+ 00:01:02,000 --> 00:01:08,000
55
+ you would need on practice and you already know enough theory to proceed with this lesson.
56
+
57
+ 15
58
+ 00:01:08,000 --> 00:01:15,000
59
+ If you watched all previous lessons, now will not have one more serious lesson because I understand
60
+
61
+ 16
62
+ 00:01:15,000 --> 00:01:21,000
63
+ that it will be hard to remember so much information without understanding how this information may
64
+
65
+ 17
66
+ 00:01:21,000 --> 00:01:22,000
67
+ help you.
68
+
69
+ 18
70
+ 00:01:22,000 --> 00:01:25,000
71
+ And why do you need to know it at all?
72
+
73
+ 19
74
+ 00:01:26,000 --> 00:01:31,000
75
+ That's why in this lesson, we'll just create a schema and one table with you.
76
+
77
+ 20
78
+ 00:01:31,000 --> 00:01:37,000
79
+ That's it sounds like not a lot of things to do, but still a lot of things to understand.
80
+
81
+ 21
82
+ 00:01:37,000 --> 00:01:40,000
83
+ I will put separate focus on naming convention.
84
+
85
+ 22
86
+ 00:01:40,000 --> 00:01:43,000
87
+ We'll talk about charset and collation.
88
+
89
+ 23
90
+ 00:01:43,000 --> 00:01:46,000
91
+ Also, we are going to review my SQL storage engines.
92
+
93
+ 24
94
+ 00:01:47,000 --> 00:01:49,000
95
+ One will start create columns in our table.
96
+
97
+ 25
98
+ 00:01:49,000 --> 00:01:53,000
99
+ You will need to understand different data types and column properties.
100
+
101
+ 26
102
+ 00:01:54,000 --> 00:01:55,000
103
+ Be prepared.
104
+
105
+ 27
106
+ 00:01:55,000 --> 00:01:58,000
107
+ This is going to be interesting and useful lesson.
108
+
109
+ 28
110
+ 00:01:58,000 --> 00:01:59,000
111
+ Let's start.
112
+
113
+ 29
114
+ 00:02:00,000 --> 00:02:02,000
115
+ Let me start from the screen sharing straightaway.
116
+
117
+ 30
118
+ 00:02:03,000 --> 00:02:08,000
119
+ As I already said, they were going to have a lot of practice activities in this lesson.
120
+
121
+ 31
122
+ 00:02:08,000 --> 00:02:10,000
123
+ We're going to work in my school workbench.
124
+
125
+ 32
126
+ 00:02:10,000 --> 00:02:17,000
127
+ In case you don't have neither my skill nor workbench installed, please refer to the previous lessons.
128
+
129
+ 33
130
+ 00:02:18,000 --> 00:02:24,000
131
+ I have separate lesson where I explained how to install my school apps on your computer and configure
132
+
133
+ 34
134
+ 00:02:24,000 --> 00:02:26,000
135
+ connection to my SQL server.
136
+
137
+ 35
138
+ 00:02:26,000 --> 00:02:35,000
139
+ So here is how our connected server looks like we are my SQL workbench, he writes about interface once
140
+
141
+ 36
142
+ 00:02:35,000 --> 00:02:37,000
143
+ connections within my SQL server is established.
144
+
145
+ 37
146
+ 00:02:37,000 --> 00:02:39,000
147
+ You have a separate topic here.
148
+
149
+ 38
150
+ 00:02:40,000 --> 00:02:43,000
151
+ You can return back on the home page if you wish.
152
+
153
+ 39
154
+ 00:02:43,000 --> 00:02:49,000
155
+ By clicking on this icon and vice versa menu options are located here on top.
156
+
157
+ 40
158
+ 00:02:50,000 --> 00:02:54,000
159
+ One of the most frequently used operations depicted, we are icons here.
160
+
161
+ 41
162
+ 00:02:55,000 --> 00:02:56,000
163
+ We're going to use them and learn.
164
+
165
+ 42
166
+ 00:02:56,000 --> 00:02:58,000
167
+ During the work was workbench.
168
+
169
+ 43
170
+ 00:02:58,000 --> 00:03:07,000
171
+ Some of them are great SQL query, tap, create schema, create table inactive database, create a new
172
+
173
+ 44
174
+ 00:03:07,000 --> 00:03:09,000
175
+ view and others.
176
+
177
+ 45
178
+ 00:03:09,000 --> 00:03:16,000
179
+ Gradually, we'll have practice with each of these options potentially set in navigator view.
180
+
181
+ 46
182
+ 00:03:16,000 --> 00:03:20,000
183
+ You have two taps, layer administration and schemas.
184
+
185
+ 47
186
+ 00:03:21,000 --> 00:03:27,000
187
+ Since this is our first practical lesson, I wouldn't start from administration tab because I believe
188
+
189
+ 48
190
+ 00:03:27,000 --> 00:03:30,000
191
+ we need to start from something more simple in this moment.
192
+
193
+ 49
194
+ 00:03:31,000 --> 00:03:37,000
195
+ We're going to have also a separate lesson where I will explain how the administrator database, including
196
+
197
+ 50
198
+ 00:03:37,000 --> 00:03:43,000
199
+ data imports and exports users and privileges configuration, server performance monitoring and others.
200
+
201
+ 51
202
+ 00:03:44,000 --> 00:03:51,000
203
+ So in this lesson, let's perform our first steps in order to create our database and fill it out with
204
+
205
+ 52
206
+ 00:03:51,000 --> 00:03:51,000
207
+ data.
208
+
209
+ 53
210
+ 00:03:52,000 --> 00:03:55,000
211
+ The first thing that we need to do is to create schema.
212
+
213
+ 54
214
+ 00:03:56,000 --> 00:03:59,000
215
+ Find this, I can hear it will help us to create schema.
216
+
217
+ 55
218
+ 00:04:00,000 --> 00:04:03,000
219
+ We need to specify name of our schema.
220
+
221
+ 56
222
+ 00:04:03,000 --> 00:04:08,000
223
+ Let's call it learning TDB and the first rule here.
224
+
225
+ 57
226
+ 00:04:08,000 --> 00:04:14,000
227
+ While this is not a strict rule and you will grigg's a database, it is still strongly recommended to
228
+
229
+ 58
230
+ 00:04:14,000 --> 00:04:20,000
231
+ follow the naming convention and naming convention is a set of unwritten rules.
232
+
233
+ 59
234
+ 00:04:20,000 --> 00:04:27,000
235
+ We all should use if you want an increase in the ability of the whole data model will apply these rules
236
+
237
+ 60
238
+ 00:04:27,000 --> 00:04:35,000
239
+ while naming A.I. inside the database tables, columns, primary and foreign keys, stored procedures,
240
+
241
+ 61
242
+ 00:04:35,000 --> 00:04:43,000
243
+ functions, views, etc. While most rules are pretty logical, you could go with some you have invented
244
+
245
+ 62
246
+ 00:04:43,000 --> 00:04:45,000
247
+ and that is completely up to you.
248
+
249
+ 63
250
+ 00:04:45,000 --> 00:04:52,000
251
+ For example, when name any data be subject, it is recommended to use lower letters in case when you
252
+
253
+ 64
254
+ 00:04:52,000 --> 00:04:54,000
255
+ to have multiple words and name.
256
+
257
+ 65
258
+ 00:04:54,000 --> 00:05:00,000
259
+ We use underscore like in this case, for example, learn, underscore key.
260
+
261
+ 66
262
+ 00:05:00,000 --> 00:05:02,000
263
+ Underscore me is a clear.
264
+
265
+ 67
266
+ 00:05:03,000 --> 00:05:10,000
267
+ I believe that it is clear for you how to use Underscores, but probably the only one things that are
268
+
269
+ 68
270
+ 00:05:10,000 --> 00:05:16,000
271
+ still not clear for you is why we need to follow naming convention and what benefits we expect to get.
272
+
273
+ 69
274
+ 00:05:16,000 --> 00:05:23,000
275
+ For example, why we just can't follow the same naming convention as we have in Java and use camel case.
276
+
277
+ 70
278
+ 00:05:24,000 --> 00:05:27,000
279
+ Let me name a few reasons to follow naming convention.
280
+
281
+ 71
282
+ 00:05:28,000 --> 00:05:28,000
283
+ Reason number one.
284
+
285
+ 72
286
+ 00:05:29,000 --> 00:05:31,000
287
+ Simplicity of the base model.
288
+
289
+ 73
290
+ 00:05:31,000 --> 00:05:35,000
291
+ Usually, you don't have just one or two tables in your database.
292
+
293
+ 74
294
+ 00:05:36,000 --> 00:05:42,000
295
+ Users are much more of them in your database, and having consistent naming would simplify navigation
296
+
297
+ 75
298
+ 00:05:42,000 --> 00:05:44,000
299
+ between the tables and data.
300
+
301
+ 76
302
+ 00:05:44,000 --> 00:05:49,000
303
+ Because to avoid total mass, you have to follow up this summer organizational rules.
304
+
305
+ 77
306
+ 00:05:49,000 --> 00:05:52,000
307
+ The second reason is database stability.
308
+
309
+ 78
310
+ 00:05:52,000 --> 00:05:58,000
311
+ If you decided to use the same naming convention as a programming language of your application, you
312
+
313
+ 79
314
+ 00:05:58,000 --> 00:06:04,000
315
+ have to remember one more rule usually that the base is one of the most stable components in your app.
316
+
317
+ 80
318
+ 00:06:05,000 --> 00:06:09,000
319
+ Changes and database layer one and only done with it is necessary.
320
+
321
+ 81
322
+ 00:06:10,000 --> 00:06:16,000
323
+ Imagine that you would like to use Java naming convention for a database, but in one year you decided
324
+
325
+ 82
326
+ 00:06:16,000 --> 00:06:24,000
327
+ to have other modules or even on loads of vital each, and those modules also interact with this database.
328
+
329
+ 83
330
+ 00:06:25,000 --> 00:06:26,000
331
+ What will you do?
332
+
333
+ 84
334
+ 00:06:26,000 --> 00:06:33,000
335
+ You can constantly change naming convention just because you changed main programming language in your
336
+
337
+ 85
338
+ 00:06:33,000 --> 00:06:35,000
339
+ app that understands this.
340
+
341
+ 86
342
+ 00:06:36,000 --> 00:06:42,000
343
+ In case you follow database naming convention, you can expect that even after you change the programming
344
+
345
+ 87
346
+ 00:06:42,000 --> 00:06:46,000
347
+ language of your app, you still have stable database there.
348
+
349
+ 88
350
+ 00:06:47,000 --> 00:06:51,000
351
+ This will help you to keep your database well, organized and structured.
352
+
353
+ 89
354
+ 00:06:52,000 --> 00:06:57,000
355
+ And the last, but not the least reason with the ability of data monitoring by each team member.
356
+
357
+ 90
358
+ 00:06:57,000 --> 00:07:03,000
359
+ Once you have specific paths that you follow, it will be easier for you and what is also important?
360
+
361
+ 91
362
+ 00:07:03,000 --> 00:07:07,000
363
+ It would be easier for colleagues of yours to query a database.
364
+
365
+ 92
366
+ 00:07:07,000 --> 00:07:15,000
367
+ What it often work Broken teams no small or big, and very often with support databases created not
368
+
369
+ 93
370
+ 00:07:15,000 --> 00:07:16,000
371
+ by us.
372
+
373
+ 94
374
+ 00:07:16,000 --> 00:07:20,000
375
+ That's why following common rules would simplify our lives.
376
+
377
+ 95
378
+ 00:07:21,000 --> 00:07:21,000
379
+ Is that clear?
380
+
381
+ 96
382
+ 00:07:22,000 --> 00:07:28,000
383
+ Even in case you still have any questions, please put your questions below this video, and I will
384
+
385
+ 97
386
+ 00:07:28,000 --> 00:07:30,000
387
+ be happy to answer those.
388
+
389
+ 98
390
+ 00:07:31,000 --> 00:07:34,000
391
+ So we specified name for our new schema.
392
+
393
+ 99
394
+ 00:07:34,000 --> 00:07:36,000
395
+ What else we need to specify here?
396
+
397
+ 100
398
+ 00:07:36,000 --> 00:07:41,000
399
+ Let's check together the next thing that we need to specify here.
400
+
401
+ 101
402
+ 00:07:41,000 --> 00:07:43,000
403
+ I charset and collation.
404
+
405
+ 102
406
+ 00:07:43,000 --> 00:07:47,000
407
+ Let's have you one by one and we'll start from Charset first.
408
+
409
+ 103
410
+ 00:07:48,000 --> 00:07:53,000
411
+ And my second character set is a set of characters that are legal in a string.
412
+
413
+ 104
414
+ 00:07:53,000 --> 00:08:00,000
415
+ For example, imagine that we have English alphabet from A to Z, and then we assign each letter to
416
+
417
+ 105
418
+ 00:08:00,000 --> 00:08:00,000
419
+ a number.
420
+
421
+ 106
422
+ 00:08:00,000 --> 00:08:04,000
423
+ We have a equal to one be equal to do and so on.
424
+
425
+ 107
426
+ 00:08:05,000 --> 00:08:07,000
427
+ In this case, a is a symbol.
428
+
429
+ 108
430
+ 00:08:08,000 --> 00:08:15,000
431
+ And number one that is associated with the letter A is encoded is a combination of all letters from
432
+
433
+ 109
434
+ 00:08:15,000 --> 00:08:20,000
435
+ A to Z and Zach responding in accordance is a character set.
436
+
437
+ 110
438
+ 00:08:20,000 --> 00:08:21,000
439
+ This makes sense.
440
+
441
+ 111
442
+ 00:08:22,000 --> 00:08:25,000
443
+ Can you understand now what the charset is?
444
+
445
+ 112
446
+ 00:08:25,000 --> 00:08:30,000
447
+ Let's select in charset UTF eight and B for?
448
+
449
+ 113
450
+ 00:08:31,000 --> 00:08:37,000
451
+ Because we need Typekit UTF eight and coding sets use for bytes to store character.
452
+
453
+ 114
454
+ 00:08:37,000 --> 00:08:46,000
455
+ By default, most people use UTF eight as Alice off UTF eight and B three is its only source and maximum
456
+
457
+ 115
458
+ 00:08:46,000 --> 00:08:48,000
459
+ of three bytes per quarter point.
460
+
461
+ 116
462
+ 00:08:49,000 --> 00:08:54,000
463
+ On the official website of my school, it is referred as deprecated and it is mentioned that it will
464
+
465
+ 117
466
+ 00:08:54,000 --> 00:08:55,000
467
+ be removed.
468
+
469
+ 118
470
+ 00:08:55,000 --> 00:09:03,000
471
+ Instead, it is recommended to use UTF eight and B for each character set has one or more correlations.
472
+
473
+ 119
474
+ 00:09:03,000 --> 00:09:04,000
475
+ Is it defined?
476
+
477
+ 120
478
+ 00:09:04,000 --> 00:09:10,000
479
+ A set of rules for comparing characters within the character set and my school collation is a set of
480
+
481
+ 121
482
+ 00:09:10,000 --> 00:09:14,000
483
+ rules used to compare characters in the particular character.
484
+
485
+ 122
486
+ 00:09:14,000 --> 00:09:21,000
487
+ Set each character set in my school as at least one default collation, and it can have more than one
488
+
489
+ 123
490
+ 00:09:21,000 --> 00:09:22,000
491
+ collation.
492
+
493
+ 124
494
+ 00:09:23,000 --> 00:09:29,000
495
+ However, the character sets cannot have the same collation, usually as there is a default collation
496
+
497
+ 125
498
+ 00:09:29,000 --> 00:09:32,000
499
+ associated with each other set.
500
+
501
+ 126
502
+ 00:09:32,000 --> 00:09:39,000
503
+ But during the creation of our schema, we can select a collation for our charset by convention.
504
+
505
+ 127
506
+ 00:09:40,000 --> 00:09:45,000
507
+ Collation for a current set begins with the character, set name and ends with.
508
+
509
+ 128
510
+ 00:09:46,000 --> 00:09:55,000
511
+ As I just stands for case insensitive, CSA stands for case sensitive or being as it stands for binary.
512
+
513
+ 129
514
+ 00:09:56,000 --> 00:10:04,000
515
+ My school allows you to specify a character set and collation at levels server, database, table and
516
+
517
+ 130
518
+ 00:10:04,000 --> 00:10:04,000
519
+ column.
520
+
521
+ 131
522
+ 00:10:05,000 --> 00:10:11,000
523
+ Currently, we can set up collation and database level, and if you are wondering which collation to
524
+
525
+ 132
526
+ 00:10:11,000 --> 00:10:19,000
527
+ choose, I recommend you to go with UTF rmv for Unicode psi so that sorting is always handled properly.
528
+
529
+ 133
530
+ 00:10:19,000 --> 00:10:22,000
531
+ It was minimal and noticeable performance drawbacks.
532
+
533
+ 134
534
+ 00:10:23,000 --> 00:10:29,000
535
+ Anyway, you can see there are really a lot of different variations of collation here, and you can
536
+
537
+ 135
538
+ 00:10:29,000 --> 00:10:35,000
539
+ check documentation to select the ones that works best for you in case you're also experiencing issues.
540
+
541
+ 136
542
+ 00:10:35,000 --> 00:10:41,000
543
+ Was interface here like I do, and you can see the whole name of just selection.
544
+
545
+ 137
546
+ 00:10:41,000 --> 00:10:42,000
547
+ Don't worry.
548
+
549
+ 138
550
+ 00:10:42,000 --> 00:10:48,000
551
+ In my school revenge area operations that you are going to perform, this translates into SQL quick
552
+
553
+ 139
554
+ 00:10:49,000 --> 00:10:52,000
555
+ and you can check query before execution of any command.
556
+
557
+ 140
558
+ 00:10:53,000 --> 00:10:57,000
559
+ By the way, this is also one of the ways to learn sequel better.
560
+
561
+ 141
562
+ 00:10:58,000 --> 00:11:02,000
563
+ I click a plain button here and here you can see SQL query.
564
+
565
+ 142
566
+ 00:11:02,000 --> 00:11:04,000
567
+ This is not the lesson about a sequel.
568
+
569
+ 143
570
+ 00:11:05,000 --> 00:11:11,000
571
+ My goal was to let you understand what operations we need and we can do in general.
572
+
573
+ 144
574
+ 00:11:11,000 --> 00:11:15,000
575
+ Our database and only after that jump to none in the sequel.
576
+
577
+ 145
578
+ 00:11:15,000 --> 00:11:20,000
579
+ Because when I started learning SQL School with students straight away, they just couldn't understand
580
+
581
+ 146
582
+ 00:11:20,000 --> 00:11:23,000
583
+ why they need this and what they're doing with it.
584
+
585
+ 147
586
+ 00:11:24,000 --> 00:11:31,000
587
+ As you can see here, we use great operator to create schema with name 90 DB with default character
588
+
589
+ 148
590
+ 00:11:31,000 --> 00:11:36,000
591
+ set UTF eight and before and collation UTF eight and before in the courtyard.
592
+
593
+ 149
594
+ 00:11:37,000 --> 00:11:44,000
595
+ Even in case you select the wrong option because you were not able to use a full name and drop down.
596
+
597
+ 150
598
+ 00:11:45,000 --> 00:11:47,000
599
+ You can adjust name of collation here.
600
+
601
+ 151
602
+ 00:11:48,000 --> 00:11:50,000
603
+ Now, query looks good to me.
604
+
605
+ 152
606
+ 00:11:50,000 --> 00:11:51,000
607
+ That's executed.
608
+
609
+ 153
610
+ 00:11:52,000 --> 00:11:58,000
611
+ In case operation was successful, you can see a sequel statement has been executed successfully.
612
+
613
+ 154
614
+ 00:11:58,000 --> 00:12:03,000
615
+ Click Finish Button now on Sikkema Step on the left.
616
+
617
+ 155
618
+ 00:12:03,000 --> 00:12:06,000
619
+ We can see that we have a new schema in the list here.
620
+
621
+ 156
622
+ 00:12:07,000 --> 00:12:13,000
623
+ Nemo Creek was mouse left click and once the name of the database is in bold, that means you selected
624
+
625
+ 157
626
+ 00:12:13,000 --> 00:12:16,000
627
+ the specific database and you can work with it.
628
+
629
+ 158
630
+ 00:12:17,000 --> 00:12:22,000
631
+ Inside, you can see that we may have tables, views, stored procedures, functions.
632
+
633
+ 159
634
+ 00:12:23,000 --> 00:12:28,000
635
+ We are going to learn how to create all these database objects and how to work with them.
636
+
637
+ 160
638
+ 00:12:28,000 --> 00:12:33,000
639
+ But in this lesson, let's create table and perform basic operations with it.
640
+
641
+ 161
642
+ 00:12:34,000 --> 00:12:38,000
643
+ We can create table people using the workbench interface in different ways.
644
+
645
+ 162
646
+ 00:12:38,000 --> 00:12:45,000
647
+ You can use one of the many items here is at the school to create new table or you can use menu.
648
+
649
+ 163
650
+ 00:12:46,000 --> 00:12:50,000
651
+ I do mouse right click on tables and select Create Table.
652
+
653
+ 164
654
+ 00:12:51,000 --> 00:12:54,000
655
+ Let me walk you through the configuration here.
656
+
657
+ 165
658
+ 00:12:55,000 --> 00:12:59,000
659
+ The first thing we need to specify here is stable name.
660
+
661
+ 166
662
+ 00:12:59,000 --> 00:13:06,000
663
+ Let's imagine that we want to create user table user table will contain information about users.
664
+
665
+ 167
666
+ 00:13:06,000 --> 00:13:10,000
667
+ And now we're in sync about naming convention for tables.
668
+
669
+ 168
670
+ 00:13:11,000 --> 00:13:17,000
671
+ One of the arguable questions is whether you need to use plural and the naming of tables or singular.
672
+
673
+ 169
674
+ 00:13:17,000 --> 00:13:24,000
675
+ For example, if you're going to store users in this table, isn't it logical to name table users in
676
+
677
+ 170
678
+ 00:13:24,000 --> 00:13:24,000
679
+ plural?
680
+
681
+ 171
682
+ 00:13:25,000 --> 00:13:27,000
683
+ So different points of view on this?
684
+
685
+ 172
686
+ 00:13:28,000 --> 00:13:28,000
687
+ Let me explain.
688
+
689
+ 173
690
+ 00:13:30,000 --> 00:13:33,000
691
+ The first option is to use Singapore four table name.
692
+
693
+ 174
694
+ 00:13:33,000 --> 00:13:35,000
695
+ That is what I would recommend you to.
696
+
697
+ 175
698
+ 00:13:36,000 --> 00:13:41,000
699
+ I prefer to use the uninfected noun, which in English happens to be singular.
700
+
701
+ 176
702
+ 00:13:42,000 --> 00:13:48,000
703
+ If your name and entities that represent real world facts, you should use nouns.
704
+
705
+ 177
706
+ 00:13:49,000 --> 00:13:54,000
707
+ These are tables like employee, customer, city and country, for example.
708
+
709
+ 178
710
+ 00:13:55,000 --> 00:14:00,000
711
+ If possible, use a single word that exactly describes what is in the table.
712
+
713
+ 179
714
+ 00:14:01,000 --> 00:14:05,000
715
+ Let's try to understand what benefits this brings to us.
716
+
717
+ 180
718
+ 00:14:05,000 --> 00:14:12,000
719
+ The first reason is logical and semantic, and really understands that this is also maybe considered
720
+
721
+ 181
722
+ 00:14:12,000 --> 00:14:13,000
723
+ as arguable point.
724
+
725
+ 182
726
+ 00:14:14,000 --> 00:14:21,000
727
+ For example, at your home, if you have back with socks, you would put a label on it that says sucks,
728
+
729
+ 183
730
+ 00:14:22,000 --> 00:14:24,000
731
+ but not Sock and Single-A.
732
+
733
+ 184
734
+ 00:14:24,000 --> 00:14:29,000
735
+ But another question why you should apply naming convention from socks to a database?
736
+
737
+ 185
738
+ 00:14:30,000 --> 00:14:30,000
739
+ Just joking.
740
+
741
+ 186
742
+ 00:14:30,000 --> 00:14:37,000
743
+ But indeed, naming people in plural form also contains some logical hosts, because if you want to
744
+
745
+ 187
746
+ 00:14:37,000 --> 00:14:42,000
747
+ name people in plural, why would don't ask us questions about grammar too?
748
+
749
+ 188
750
+ 00:14:43,000 --> 00:14:49,000
751
+ For example, we also might be thinking about questions like this, since we're usually doing something
752
+
753
+ 189
754
+ 00:14:49,000 --> 00:14:50,000
755
+ with zeros.
756
+
757
+ 190
758
+ 00:14:50,000 --> 00:14:55,000
759
+ Why not to put the name in the accusative case or another question?
760
+
761
+ 191
762
+ 00:14:55,000 --> 00:15:03,000
763
+ If we have a tables that will write to laws and we agree, why not put the name indeed, if it is table
764
+
765
+ 192
766
+ 00:15:03,000 --> 00:15:04,000
767
+ of Simpson?
768
+
769
+ 193
770
+ 00:15:04,000 --> 00:15:06,000
771
+ Why not use genitive?
772
+
773
+ 194
774
+ 00:15:07,000 --> 00:15:07,000
775
+ And you know what?
776
+
777
+ 195
778
+ 00:15:08,000 --> 00:15:12,000
779
+ We will not constantly address all of these questions because we will end up with a mess.
780
+
781
+ 196
782
+ 00:15:13,000 --> 00:15:15,000
783
+ The table is defined as an abstract.
784
+
785
+ 197
786
+ 00:15:15,000 --> 00:15:20,000
787
+ Content exists regardless of its state or usage uses.
788
+
789
+ 198
790
+ 00:15:20,000 --> 00:15:26,000
791
+ An unaffected noun is simple, logical, regular and language independent.
792
+
793
+ 199
794
+ 00:15:27,000 --> 00:15:28,000
795
+ The second reason is convenience.
796
+
797
+ 200
798
+ 00:15:29,000 --> 00:15:32,000
799
+ It is easy to come out with a single names.
800
+
801
+ 201
802
+ 00:15:32,000 --> 00:15:33,000
803
+ Xen was plural.
804
+
805
+ 202
806
+ 00:15:33,000 --> 00:15:41,000
807
+ Once objects can have irregular plurals, are not normal at all, but will always have a single one.
808
+
809
+ 203
810
+ 00:15:41,000 --> 00:15:43,000
811
+ With few exceptions like news.
812
+
813
+ 204
814
+ 00:15:44,000 --> 00:15:46,000
815
+ Another reason is simplicity.
816
+
817
+ 205
818
+ 00:15:46,000 --> 00:15:51,000
819
+ One little gem to learn in the sequel, you are going to use table names for queries.
820
+
821
+ 206
822
+ 00:15:51,000 --> 00:15:58,000
823
+ Also, we're going to refer to attributes of a table like, for example, to get the value of name attributes
824
+
825
+ 207
826
+ 00:15:58,000 --> 00:15:58,000
827
+ and use.
828
+
829
+ 208
830
+ 00:15:58,000 --> 00:16:04,000
831
+ Our table will use user not name, but not users, not name.
832
+
833
+ 209
834
+ 00:16:04,000 --> 00:16:07,000
835
+ And it seems logical and simple.
836
+
837
+ 210
838
+ 00:16:07,000 --> 00:16:08,000
839
+ Don't you think so?
840
+
841
+ 211
842
+ 00:16:08,000 --> 00:16:13,000
843
+ You extract the name of specific user, but not all users.
844
+
845
+ 212
846
+ 00:16:14,000 --> 00:16:14,000
847
+ Definitely.
848
+
849
+ 213
850
+ 00:16:14,000 --> 00:16:19,000
851
+ I can find the workarounds for these two more experienced students.
852
+
853
+ 214
854
+ 00:16:19,000 --> 00:16:24,000
855
+ While watching this video may mention that we can use Alliss for table names.
856
+
857
+ 215
858
+ 00:16:24,000 --> 00:16:26,000
859
+ But why we need to do this?
860
+
861
+ 216
862
+ 00:16:26,000 --> 00:16:29,000
863
+ You could just can name table in singular.
864
+
865
+ 217
866
+ 00:16:29,000 --> 00:16:29,000
867
+ And that's it.
868
+
869
+ 218
870
+ 00:16:30,000 --> 00:16:35,000
871
+ I'm the guy who always finds a way to simplify everything to the possible degree.
872
+
873
+ 219
874
+ 00:16:35,000 --> 00:16:37,000
875
+ And this is one of the cases.
876
+
877
+ 220
878
+ 00:16:37,000 --> 00:16:43,000
879
+ One more reason is that often consider it's not like an important one, but still it's worth of your
880
+
881
+ 221
882
+ 00:16:43,000 --> 00:16:43,000
883
+ attention.
884
+
885
+ 222
886
+ 00:16:44,000 --> 00:16:45,000
887
+ It is globalization.
888
+
889
+ 223
890
+ 00:16:45,000 --> 00:16:51,000
891
+ We often work in multinational teams, and we're often for many of team members.
892
+
893
+ 224
894
+ 00:16:51,000 --> 00:16:58,000
895
+ English is not native language and having a repository table instead of repositories or having status
896
+
897
+ 225
898
+ 00:16:58,000 --> 00:17:00,000
899
+ table instead of statuses.
900
+
901
+ 226
902
+ 00:17:00,000 --> 00:17:07,000
903
+ We'll save your team a lot of time and minimize errors because of typos and similar linguistic issues.
904
+
905
+ 227
906
+ 00:17:07,000 --> 00:17:13,000
907
+ Probably this is not like the most critical reason to use single names for tables.
908
+
909
+ 228
910
+ 00:17:13,000 --> 00:17:15,000
911
+ But promise me just to think about it.
912
+
913
+ 229
914
+ 00:17:16,000 --> 00:17:23,000
915
+ And that's a point to think about, you know, the table names may consist of multiple words separated
916
+
917
+ 230
918
+ 00:17:23,000 --> 00:17:27,000
919
+ by underscore this would raise additional questions from your team.
920
+
921
+ 231
922
+ 00:17:27,000 --> 00:17:30,000
923
+ What words should be in plural and which not?
924
+
925
+ 232
926
+ 00:17:31,000 --> 00:17:37,000
927
+ For example, or the detail if you use single zone, no questions at all.
928
+
929
+ 233
930
+ 00:17:37,000 --> 00:17:42,000
931
+ It is simple to write queries because you remember that everything isn't singular.
932
+
933
+ 234
934
+ 00:17:43,000 --> 00:17:46,000
935
+ But in case you would like to follow some grammar, how far will you go?
936
+
937
+ 235
938
+ 00:17:47,000 --> 00:17:54,000
939
+ Really use all the details or some key members, many things that you should name this table as order
940
+
941
+ 236
942
+ 00:17:54,000 --> 00:17:55,000
943
+ details.
944
+
945
+ 237
946
+ 00:17:55,000 --> 00:18:01,000
947
+ Believe me, this might happen and this will happen in big multinational team, and they give you a
948
+
949
+ 238
950
+ 00:18:01,000 --> 00:18:05,000
951
+ chance to think about it right now before you start that new project.
952
+
953
+ 239
954
+ 00:18:06,000 --> 00:18:10,000
955
+ And always remember the tables are the subjects of the database.
956
+
957
+ 240
958
+ 00:18:10,000 --> 00:18:14,000
959
+ Thus, they announce again, Single-A.
960
+
961
+ 241
962
+ 00:18:15,000 --> 00:18:21,000
963
+ There might be different reasons to use single for table names, but in my opinion, these are the most
964
+
965
+ 242
966
+ 00:18:21,000 --> 00:18:21,000
967
+ important ones.
968
+
969
+ 243
970
+ 00:18:22,000 --> 00:18:23,000
971
+ I wouldn't like to use that.
972
+
973
+ 244
974
+ 00:18:23,000 --> 00:18:30,000
975
+ I always worked on the projects where tables were named as singular, sometimes so rotten project where
976
+
977
+ 245
978
+ 00:18:30,000 --> 00:18:36,000
979
+ we use plural for database tables, names and remember the main sink in.
980
+
981
+ 246
982
+ 00:18:36,000 --> 00:18:38,000
983
+ Each naming convention is consistency.
984
+
985
+ 247
986
+ 00:18:39,000 --> 00:18:44,000
987
+ The whole team agreed to follow some specific naming convention and different generation of programmers.
988
+
989
+ 248
990
+ 00:18:44,000 --> 00:18:50,000
991
+ Since this project also understands this and agreed with this, then you don't have any problem at all.
992
+
993
+ 249
994
+ 00:18:50,000 --> 00:18:56,000
995
+ And then comes a day your team might find logical the name container or froze with plural if container
996
+
997
+ 250
998
+ 00:18:56,000 --> 00:18:58,000
999
+ contains users.
1000
+
1001
+ 251
1002
+ 00:18:58,000 --> 00:19:05,000
1003
+ It is obvious that we have to name it users, but we also reviewed point of use that explains why this
1004
+
1005
+ 252
1006
+ 00:19:05,000 --> 00:19:08,000
1007
+ might not always be the best way to name a table.
1008
+
1009
+ 253
1010
+ 00:19:09,000 --> 00:19:14,000
1011
+ To be honest, it is hard for me to come up with other advantages of using plural names for tables.
1012
+
1013
+ 254
1014
+ 00:19:15,000 --> 00:19:19,000
1015
+ Remember, it is always up to you what naming convention you are going to follow.
1016
+
1017
+ 255
1018
+ 00:19:20,000 --> 00:19:26,000
1019
+ But the most important here is consistency in naming across different parts of your app.
1020
+
1021
+ 256
1022
+ 00:19:26,000 --> 00:19:32,000
1023
+ I believe I answer to all concerns regarding the naming convention and why I named the bill in singular
1024
+
1025
+ 257
1026
+ 00:19:32,000 --> 00:19:33,000
1027
+ form.
1028
+
1029
+ 258
1030
+ 00:19:33,000 --> 00:19:34,000
1031
+ Let's proceed.
1032
+
1033
+ 259
1034
+ 00:19:34,000 --> 00:19:40,000
1035
+ So you already know that you can set charset and collation on table level two.
1036
+
1037
+ 260
1038
+ 00:19:40,000 --> 00:19:44,000
1039
+ Another interesting configuration here is an engine.
1040
+
1041
+ 261
1042
+ 00:19:44,000 --> 00:19:45,000
1043
+ Let's talk about it now.
1044
+
1045
+ 262
1046
+ 00:19:46,000 --> 00:19:50,000
1047
+ Let me explain you more about search engines in my school.
1048
+
1049
+ 263
1050
+ 00:19:50,000 --> 00:19:57,000
1051
+ The search engine is a software module that database management system uses for me operations with data
1052
+
1053
+ 264
1054
+ 00:19:58,000 --> 00:20:00,000
1055
+ such as Create, Read, Update, Delete.
1056
+
1057
+ 265
1058
+ 00:20:01,000 --> 00:20:08,000
1059
+ Generally speaking, there are two types of storage engines in my school transactional and non transactional.
1060
+
1061
+ 266
1062
+ 00:20:08,000 --> 00:20:11,000
1063
+ In my school, we have nine types of storage engines.
1064
+
1065
+ 267
1066
+ 00:20:12,000 --> 00:20:15,000
1067
+ Two campuses was a school bus.
1068
+
1069
+ 268
1070
+ 00:20:15,000 --> 00:20:17,000
1071
+ With schools, there's one storage engine.
1072
+
1073
+ 269
1074
+ 00:20:18,000 --> 00:20:24,000
1075
+ It is very important to select the right search engine because this is strategic decision that will
1076
+
1077
+ 270
1078
+ 00:20:24,000 --> 00:20:25,000
1079
+ impact future development.
1080
+
1081
+ 271
1082
+ 00:20:25,000 --> 00:20:32,000
1083
+ The default search engine in my school is in the B from version five point five and later.
1084
+
1085
+ 272
1086
+ 00:20:32,000 --> 00:20:34,000
1087
+ Previously, it was my is some.
1088
+
1089
+ 273
1090
+ 00:20:35,000 --> 00:20:38,000
1091
+ Let me very briefly cover each storage engine in order.
1092
+
1093
+ 274
1094
+ 00:20:38,000 --> 00:20:40,000
1095
+ You could understand the difference.
1096
+
1097
+ 275
1098
+ 00:20:41,000 --> 00:20:46,000
1099
+ In a debate is the most widely used storage engine with transaction support.
1100
+
1101
+ 276
1102
+ 00:20:46,000 --> 00:20:53,000
1103
+ It is an acid compliant storage engine as it compliant means it meets requirements for transactions
1104
+
1105
+ 277
1106
+ 00:20:54,000 --> 00:20:59,000
1107
+ as it is an acronym that stands for atomic consistent, independent, durable.
1108
+
1109
+ 278
1110
+ 00:21:00,000 --> 00:21:04,000
1111
+ These are properties of transactions that we are going to cover in detail.
1112
+
1113
+ 279
1114
+ 00:21:04,000 --> 00:21:11,000
1115
+ A lesson about transactions in a the B supports roll level locking crash recovery and motivation version
1116
+
1117
+ 280
1118
+ 00:21:11,000 --> 00:21:13,000
1119
+ concurrency control.
1120
+
1121
+ 281
1122
+ 00:21:13,000 --> 00:21:18,000
1123
+ It is the only engine which provides foreign key, referential integrity constrained.
1124
+
1125
+ 282
1126
+ 00:21:19,000 --> 00:21:26,000
1127
+ Oracle recommends using Unity B for tables except for specialized use cases, and thus the search engine
1128
+
1129
+ 283
1130
+ 00:21:26,000 --> 00:21:27,000
1131
+ is my is.
1132
+
1133
+ 284
1134
+ 00:21:27,000 --> 00:21:31,000
1135
+ The main difference from Inada be it is not transactional one.
1136
+
1137
+ 285
1138
+ 00:21:32,000 --> 00:21:34,000
1139
+ It is a relatively fast storage engine.
1140
+
1141
+ 286
1142
+ 00:21:35,000 --> 00:21:39,000
1143
+ But as we already said, it doesn't support transactions.
1144
+
1145
+ 287
1146
+ 00:21:39,000 --> 00:21:42,000
1147
+ My ISA provides stable level locking.
1148
+
1149
+ 288
1150
+ 00:21:42,000 --> 00:21:45,000
1151
+ It is used mostly in lab and data warehousing.
1152
+
1153
+ 289
1154
+ 00:21:46,000 --> 00:21:49,000
1155
+ Let me say now a few words about memory storage engine.
1156
+
1157
+ 290
1158
+ 00:21:50,000 --> 00:21:56,000
1159
+ It is named, so because it creates tables in memory, it is the fastest engine.
1160
+
1161
+ 291
1162
+ 00:21:56,000 --> 00:21:58,000
1163
+ It provides stable level locking.
1164
+
1165
+ 292
1166
+ 00:21:59,000 --> 00:22:01,000
1167
+ It doesn't support transactions.
1168
+
1169
+ 293
1170
+ 00:22:01,000 --> 00:22:06,000
1171
+ Memory storage engine is ideal for creating temporary tables or quick look ups.
1172
+
1173
+ 294
1174
+ 00:22:07,000 --> 00:22:10,000
1175
+ The data is lost when the database is restarted.
1176
+
1177
+ 295
1178
+ 00:22:10,000 --> 00:22:16,000
1179
+ Different news There are not so many use cases for the search engine because each application requires
1180
+
1181
+ 296
1182
+ 00:22:16,000 --> 00:22:17,000
1183
+ persistent storage.
1184
+
1185
+ 297
1186
+ 00:22:18,000 --> 00:22:21,000
1187
+ See, a Swiss storage engine has specific formats of the stored data.
1188
+
1189
+ 298
1190
+ 00:22:22,000 --> 00:22:24,000
1191
+ It stores data in CSP files.
1192
+
1193
+ 299
1194
+ 00:22:24,000 --> 00:22:31,000
1195
+ It provides great flexibility because data in this format is easily integrated into other applications.
1196
+
1197
+ 300
1198
+ 00:22:31,000 --> 00:22:35,000
1199
+ Match operates on underlying might e some tables.
1200
+
1201
+ 301
1202
+ 00:22:35,000 --> 00:22:39,000
1203
+ Match tables help manage large volume of data more easily.
1204
+
1205
+ 302
1206
+ 00:22:40,000 --> 00:22:46,000
1207
+ It logically groups a series of identical might use some tables and references them as one object.
1208
+
1209
+ 303
1210
+ 00:22:46,000 --> 00:22:53,000
1211
+ Good for data warehousing environments Archive search engine is optimized for high speed and certain
1212
+
1213
+ 304
1214
+ 00:22:54,000 --> 00:22:56,000
1215
+ it compresses data as it is inserted.
1216
+
1217
+ 305
1218
+ 00:22:57,000 --> 00:22:59,000
1219
+ It doesn't support transactions.
1220
+
1221
+ 306
1222
+ 00:22:59,000 --> 00:23:07,000
1223
+ It is a yield for storing and retrieving large amounts of seldom referenced historical archive data.
1224
+
1225
+ 307
1226
+ 00:23:08,000 --> 00:23:14,000
1227
+ The black hole search engine accepts but doesn't store data which reveals always written and them to
1228
+
1229
+ 308
1230
+ 00:23:14,000 --> 00:23:16,000
1231
+ set critical feature.
1232
+
1233
+ 309
1234
+ 00:23:16,000 --> 00:23:17,000
1235
+ Don't you think so?
1236
+
1237
+ 310
1238
+ 00:23:17,000 --> 00:23:18,000
1239
+ And I understand your feeling.
1240
+
1241
+ 311
1242
+ 00:23:19,000 --> 00:23:25,000
1243
+ Probably it is not so easy to come up with the use case for such storing engine, but I have few use
1244
+
1245
+ 312
1246
+ 00:23:25,000 --> 00:23:28,000
1247
+ cases when this might come in handy.
1248
+
1249
+ 313
1250
+ 00:23:28,000 --> 00:23:34,000
1251
+ The French analogy can be used in distributed database design, where data is automatically replicated
1252
+
1253
+ 314
1254
+ 00:23:34,000 --> 00:23:37,000
1255
+ but not stored locally and also does.
1256
+
1257
+ 315
1258
+ 00:23:37,000 --> 00:23:42,000
1259
+ This search engine can be used to execute performance tests or other testing.
1260
+
1261
+ 316
1262
+ 00:23:43,000 --> 00:23:49,000
1263
+ Federated Search Engine offers the ability to separate my Secret Service to create one logical database
1264
+
1265
+ 317
1266
+ 00:23:49,000 --> 00:23:51,000
1267
+ from many physical service.
1268
+
1269
+ 318
1270
+ 00:23:51,000 --> 00:23:57,000
1271
+ Queries on the local server are automatically executed on the remote federated tables.
1272
+
1273
+ 319
1274
+ 00:23:57,000 --> 00:24:00,000
1275
+ No data is stored on the local tables.
1276
+
1277
+ 320
1278
+ 00:24:00,000 --> 00:24:07,000
1279
+ It is good for distributed environments, and the B cluster is an in-memory storage engine, offering
1280
+
1281
+ 321
1282
+ 00:24:07,000 --> 00:24:10,000
1283
+ high availability and data persistence features.
1284
+
1285
+ 322
1286
+ 00:24:11,000 --> 00:24:18,000
1287
+ The engine cluster storage engine can be configured with a range or fail over and load balancing options.
1288
+
1289
+ 323
1290
+ 00:24:18,000 --> 00:24:25,000
1291
+ Using SQL notes is the most common way of executing queries, and SQL note is the same as an instance
1292
+
1293
+ 324
1294
+ 00:24:25,000 --> 00:24:33,000
1295
+ of my SQL server was the NDB storage engine compiled in the NDB search engine provides a breach from
1296
+
1297
+ 325
1298
+ 00:24:33,000 --> 00:24:34,000
1299
+ my SQL server.
1300
+
1301
+ 326
1302
+ 00:24:34,000 --> 00:24:41,000
1303
+ List of data nodes and DB search engine is implemented using a distributed shared nutzen architecture,
1304
+
1305
+ 327
1306
+ 00:24:42,000 --> 00:24:47,000
1307
+ which causes it to behave differently from anybody b in a number of ways.
1308
+
1309
+ 328
1310
+ 00:24:47,000 --> 00:24:55,000
1311
+ For those unaccustomed to work and was NDB, unexpected behaviors can arise is distributed nature with
1312
+
1313
+ 329
1314
+ 00:24:55,000 --> 00:25:01,000
1315
+ regard to transactions for in case table limits and other characteristics.
1316
+
1317
+ 330
1318
+ 00:25:01,000 --> 00:25:07,000
1319
+ This is not so easy to explain in a few sentences, but in general, if you are interested, you can
1320
+
1321
+ 331
1322
+ 00:25:07,000 --> 00:25:12,000
1323
+ ask is a specific question about the search engine or find documentation on my SQL side.
1324
+
1325
+ 332
1326
+ 00:25:13,000 --> 00:25:17,000
1327
+ So what search engine to choose among such variety?
1328
+
1329
+ 333
1330
+ 00:25:17,000 --> 00:25:23,000
1331
+ It depends on the up to you and business problem you are trying to address and once saying you should
1332
+
1333
+ 334
1334
+ 00:25:23,000 --> 00:25:29,000
1335
+ remember for sure, there is no perfect search engine littered with works the best in all possible cases.
1336
+
1337
+ 335
1338
+ 00:25:29,000 --> 00:25:35,000
1339
+ Some of them better under certain conditions and perform worse in other situations, and some of them
1340
+
1341
+ 336
1342
+ 00:25:35,000 --> 00:25:36,000
1343
+ vice versa.
1344
+
1345
+ 337
1346
+ 00:25:37,000 --> 00:25:41,000
1347
+ In software engineering, it is always a matter of tradeoffs and.
1348
+
1349
+ 338
1350
+ 00:25:41,000 --> 00:25:43,000
1351
+ Most secure solution takes more resources.
1352
+
1353
+ 339
1354
+ 00:25:44,000 --> 00:25:48,000
1355
+ Thus, it might be slower, take more CPU time and disk space.
1356
+
1357
+ 340
1358
+ 00:25:49,000 --> 00:25:54,000
1359
+ But you should understand that you have not one but nine storage engines.
1360
+
1361
+ 341
1362
+ 00:25:54,000 --> 00:26:00,000
1363
+ And my sequel is very flexible in the fact that it provides several different storage engines.
1364
+
1365
+ 342
1366
+ 00:26:00,000 --> 00:26:05,000
1367
+ Some of them, like archive engine, are created to be used in specific situations.
1368
+
1369
+ 343
1370
+ 00:26:06,000 --> 00:26:13,000
1371
+ In some cases, the answer is clear whenever we're dealing with some payment systems, we are obligated
1372
+
1373
+ 344
1374
+ 00:26:13,000 --> 00:26:15,000
1375
+ to use the transactional storage.
1376
+
1377
+ 345
1378
+ 00:26:15,000 --> 00:26:21,000
1379
+ We cannot afford to lose such sensitive data in a debate is the way to go.
1380
+
1381
+ 346
1382
+ 00:26:22,000 --> 00:26:27,000
1383
+ If we want full text search, then we can choose is a mighty sum or in the be.
1384
+
1385
+ 347
1386
+ 00:26:28,000 --> 00:26:33,000
1387
+ Now, you know, the difference between different storage engines in our particular case.
1388
+
1389
+ 348
1390
+ 00:26:33,000 --> 00:26:38,000
1391
+ Let's keep the default one here, so I keep an eye on the Beast search engine.
1392
+
1393
+ 349
1394
+ 00:26:38,000 --> 00:26:41,000
1395
+ After that, we can proceed with declaring columns.
1396
+
1397
+ 350
1398
+ 00:26:41,000 --> 00:26:42,000
1399
+ Let's use surrogate.
1400
+
1401
+ 351
1402
+ 00:26:42,000 --> 00:26:48,000
1403
+ Primary key was name I.D. for each row, and let's make it of type in.
1404
+
1405
+ 352
1406
+ 00:26:49,000 --> 00:26:53,000
1407
+ You have to fill out column name, data type and set column properties.
1408
+
1409
+ 353
1410
+ 00:26:54,000 --> 00:26:59,000
1411
+ We are going to learn more about each column property right after we finish a discussion about data
1412
+
1413
+ 354
1414
+ 00:26:59,000 --> 00:26:59,000
1415
+ types.
1416
+
1417
+ 355
1418
+ 00:27:00,000 --> 00:27:06,000
1419
+ As you see, each column will have its own data type, then different types and different relational
1420
+
1421
+ 356
1422
+ 00:27:06,000 --> 00:27:11,000
1423
+ database management systems, but more or less this similar in my cycle.
1424
+
1425
+ 357
1426
+ 00:27:11,000 --> 00:27:19,000
1427
+ All data types might be grouped into the next categories numeric data types date and time data types
1428
+
1429
+ 358
1430
+ 00:27:20,000 --> 00:27:29,000
1431
+ string data types spatial data types My circle supports geometry types of point lines, string, polygon
1432
+
1433
+ 359
1434
+ 00:27:29,000 --> 00:27:37,000
1435
+ multipoint, multi-line string, multi polygon and Geometry Collection OSR geometry types are not supported.
1436
+
1437
+ 360
1438
+ 00:27:38,000 --> 00:27:44,000
1439
+ JSON data type most likely will not go over each and every possible data type.
1440
+
1441
+ 361
1442
+ 00:27:44,000 --> 00:27:52,000
1443
+ In my school, I prepared slides to cover the most popular numeric date and time and string data types.
1444
+
1445
+ 362
1446
+ 00:27:53,000 --> 00:27:59,000
1447
+ On this slide, you can find numeric data types, I suppose, for a minute if you want to read comments
1448
+
1449
+ 363
1450
+ 00:27:59,000 --> 00:28:05,000
1451
+ for each particular data type here, but in most cases you are going to use and type.
1452
+
1453
+ 364
1454
+ 00:28:06,000 --> 00:28:09,000
1455
+ That is my opinion, probably sometimes.
1456
+
1457
+ 365
1458
+ 00:28:09,000 --> 00:28:11,000
1459
+ So I'm going to use other data types too.
1460
+
1461
+ 366
1462
+ 00:28:11,000 --> 00:28:19,000
1463
+ But in time is generally enough, especially if we use unsigned and you have one more additional beat
1464
+
1465
+ 367
1466
+ 00:28:19,000 --> 00:28:26,000
1467
+ to store information and attention in this list, you have both integers and floating point numbers,
1468
+
1469
+ 368
1470
+ 00:28:26,000 --> 00:28:32,000
1471
+ so you can select data type for your columns that meets business needs to store value.
1472
+
1473
+ 369
1474
+ 00:28:32,000 --> 00:28:40,000
1475
+ On this slide, you can find data types that will help you to represent date and time in database humorists
1476
+
1477
+ 370
1478
+ 00:28:40,000 --> 00:28:47,000
1479
+ or date or time separately, or you can store data time looking with date and time.
1480
+
1481
+ 371
1482
+ 00:28:47,000 --> 00:28:49,000
1483
+ And what original app always was a patent?
1484
+
1485
+ 372
1486
+ 00:28:50,000 --> 00:28:50,000
1487
+ Why?
1488
+
1489
+ 373
1490
+ 00:28:51,000 --> 00:28:58,000
1491
+ First of all, for Martin, during the storm and database and retrieved from database, it seems to
1492
+
1493
+ 374
1494
+ 00:28:58,000 --> 00:28:59,000
1495
+ be like a simple scene.
1496
+
1497
+ 375
1498
+ 00:28:59,000 --> 00:29:06,000
1499
+ But I promise you, at least someone from your team will mess up was for the second things that might
1500
+
1501
+ 376
1502
+ 00:29:06,000 --> 00:29:08,000
1503
+ be challenging time zones.
1504
+
1505
+ 377
1506
+ 00:29:09,000 --> 00:29:12,000
1507
+ Team, believe me, time zones are very, very painful.
1508
+
1509
+ 378
1510
+ 00:29:13,000 --> 00:29:20,000
1511
+ Some engineers use time stamp to store a number of seconds since Unix epoch, but there is a specific
1512
+
1513
+ 379
1514
+ 00:29:20,000 --> 00:29:23,000
1515
+ range of data that is supported by my SQL by default.
1516
+
1517
+ 380
1518
+ 00:29:23,000 --> 00:29:30,000
1519
+ So one of us options, probably it is not super duper popular, but still look around.
1520
+
1521
+ 381
1522
+ 00:29:30,000 --> 00:29:31,000
1523
+ It deserves to leave.
1524
+
1525
+ 382
1526
+ 00:29:32,000 --> 00:29:40,000
1527
+ You can use even in data types to serve milliseconds from Unix epoch heaven, time and milliseconds.
1528
+
1529
+ 383
1530
+ 00:29:40,000 --> 00:29:46,000
1531
+ You can convert it in any app any day during the conversion in both direction.
1532
+
1533
+ 384
1534
+ 00:29:46,000 --> 00:29:48,000
1535
+ You can consider time zone of the user.
1536
+
1537
+ 385
1538
+ 00:29:49,000 --> 00:29:53,000
1539
+ In this case, all milliseconds would be according to UTC.
1540
+
1541
+ 386
1542
+ 00:29:53,000 --> 00:29:56,000
1543
+ The Understand what I'm talking about.
1544
+
1545
+ 387
1546
+ 00:29:56,000 --> 00:29:58,000
1547
+ Remember this workaround?
1548
+
1549
+ 388
1550
+ 00:29:58,000 --> 00:30:03,000
1551
+ It might help you some day and no matter what application you will work with.
1552
+
1553
+ 389
1554
+ 00:30:03,000 --> 00:30:09,000
1555
+ And also, if you want to learn more about date and time in Java, please refer to my Java course.
1556
+
1557
+ 390
1558
+ 00:30:09,000 --> 00:30:15,000
1559
+ I have separate lessons, dedicated time zones and working with date and time in Java programs.
1560
+
1561
+ 391
1562
+ 00:30:15,000 --> 00:30:21,000
1563
+ And on this slide, you can see a list of data types that you can use to store text values.
1564
+
1565
+ 392
1566
+ 00:30:21,000 --> 00:30:27,000
1567
+ One of the differences between all these types is amount of memory that is reserved to stores.
1568
+
1569
+ 393
1570
+ 00:30:27,000 --> 00:30:33,000
1571
+ The value in this field bressan course if you want to check comments for each day that that.
1572
+
1573
+ 394
1574
+ 00:30:34,000 --> 00:30:37,000
1575
+ So we learned what data types might be used for columns.
1576
+
1577
+ 395
1578
+ 00:30:38,000 --> 00:30:40,000
1579
+ Now let's learn another thing.
1580
+
1581
+ 396
1582
+ 00:30:40,000 --> 00:30:42,000
1583
+ Let's talk about column properties.
1584
+
1585
+ 397
1586
+ 00:30:43,000 --> 00:30:45,000
1587
+ You can see different letters here.
1588
+
1589
+ 398
1590
+ 00:30:45,000 --> 00:30:49,000
1591
+ And also the checkbox here they are the same.
1592
+
1593
+ 399
1594
+ 00:30:50,000 --> 00:30:52,000
1595
+ Let's learn what those they meant.
1596
+
1597
+ 400
1598
+ 00:30:53,000 --> 00:30:59,000
1599
+ K stands for primary key and N stands for Not Now You.
1600
+
1601
+ 401
1602
+ 00:30:59,000 --> 00:31:01,000
1603
+ Q stands for unique.
1604
+
1605
+ 402
1606
+ 00:31:01,000 --> 00:31:03,000
1607
+ This creates unique index.
1608
+
1609
+ 403
1610
+ 00:31:03,000 --> 00:31:06,000
1611
+ We're going to learn about indexes in the separate lesson.
1612
+
1613
+ 404
1614
+ 00:31:07,000 --> 00:31:10,000
1615
+ B stands for binary stores data as binary strings.
1616
+
1617
+ 405
1618
+ 00:31:11,000 --> 00:31:18,000
1619
+ There is no character set so certain, and comparison is based on the numerical values of the bytes
1620
+
1621
+ 406
1622
+ 00:31:18,000 --> 00:31:21,000
1623
+ in the values you and stands for.
1624
+
1625
+ 407
1626
+ 00:31:21,000 --> 00:31:21,000
1627
+ And.
1628
+
1629
+ 408
1630
+ 00:31:22,000 --> 00:31:27,000
1631
+ That is property for all no data types that allows you to store only positive numbers.
1632
+
1633
+ 409
1634
+ 00:31:28,000 --> 00:31:30,000
1635
+ ZF stands for zero field.
1636
+
1637
+ 410
1638
+ 00:31:30,000 --> 00:31:32,000
1639
+ This is an interesting one.
1640
+
1641
+ 411
1642
+ 00:31:32,000 --> 00:31:39,000
1643
+ I need to demo this will use zero field property for one of the fields just in demo purposes.
1644
+
1645
+ 412
1646
+ 00:31:39,000 --> 00:31:44,000
1647
+ In short, it feels with zero all the lengths reserved for value.
1648
+
1649
+ 413
1650
+ 00:31:44,000 --> 00:31:47,000
1651
+ Eight AI stands for auto increment.
1652
+
1653
+ 414
1654
+ 00:31:47,000 --> 00:31:50,000
1655
+ No value can be increased by one.
1656
+
1657
+ 415
1658
+ 00:31:50,000 --> 00:31:55,000
1659
+ Usually, this one is used for surrogate primary keys in order that the base can generate unique number
1660
+
1661
+ 416
1662
+ 00:31:55,000 --> 00:32:05,000
1663
+ for ID field by increment in values with each new record inserted and G stands for generated, the value
1664
+
1665
+ 417
1666
+ 00:32:05,000 --> 00:32:09,000
1667
+ is generated by a formula based on other columns.
1668
+
1669
+ 418
1670
+ 00:32:10,000 --> 00:32:17,000
1671
+ If the field is primary key, that means that this field will have only unique values, not new values.
1672
+
1673
+ 419
1674
+ 00:32:17,000 --> 00:32:21,000
1675
+ Additionally, I recommend you to at all to increment property.
1676
+
1677
+ 420
1678
+ 00:32:21,000 --> 00:32:27,000
1679
+ This will automatically increment your I.D. integer value on each new insertion.
1680
+
1681
+ 421
1682
+ 00:32:28,000 --> 00:32:30,000
1683
+ In this case, you shouldn't be to.
1684
+
1685
+ 422
1686
+ 00:32:30,000 --> 00:32:32,000
1687
+ It's a generation of unique I.D..
1688
+
1689
+ 423
1690
+ 00:32:33,000 --> 00:32:39,000
1691
+ Also, I want to use unsigned integer values in order to increase range of positive numbers that can
1692
+
1693
+ 424
1694
+ 00:32:39,000 --> 00:32:40,000
1695
+ be used as I.D..
1696
+
1697
+ 425
1698
+ 00:32:41,000 --> 00:32:44,000
1699
+ Let's also create a few more fields of virtual time.
1700
+
1701
+ 426
1702
+ 00:32:45,000 --> 00:32:50,000
1703
+ We're going to create first name, last name and email to create each new field.
1704
+
1705
+ 427
1706
+ 00:32:50,000 --> 00:32:53,000
1707
+ Just press on empty space.
1708
+
1709
+ 428
1710
+ 00:32:55,000 --> 00:33:02,000
1711
+ I will create unique index for email column to make performance of extract any user by email data and
1712
+
1713
+ 429
1714
+ 00:33:02,000 --> 00:33:03,000
1715
+ cluster.
1716
+
1717
+ 430
1718
+ 00:33:06,000 --> 00:33:12,000
1719
+ According to naming convention, we use lowercase and the words are separated, which underscores their
1720
+
1721
+ 431
1722
+ 00:33:12,000 --> 00:33:17,000
1723
+ tension that you have to specify maximum length of zero hour char.
1724
+
1725
+ 432
1726
+ 00:33:17,000 --> 00:33:25,000
1727
+ By default, this forty five characters you can just click in data era type and change this limit.
1728
+
1729
+ 433
1730
+ 00:33:26,000 --> 00:33:31,000
1731
+ And as I said, let me demo zero field property for our property.
1732
+
1733
+ 434
1734
+ 00:33:31,000 --> 00:33:34,000
1735
+ We would adjust lengths of data time to five.
1736
+
1737
+ 435
1738
+ 00:33:35,000 --> 00:33:38,000
1739
+ Also, we will select the checkbox.
1740
+
1741
+ 436
1742
+ 00:33:38,000 --> 00:33:45,000
1743
+ So when you're ready, you can click Apply button sequel query will be shown for you to approve.
1744
+
1745
+ 437
1746
+ 00:33:46,000 --> 00:33:48,000
1747
+ We're going to learn SQL in a separate lessons.
1748
+
1749
+ 438
1750
+ 00:33:48,000 --> 00:33:54,000
1751
+ We'll also cover create table statements, but you already can start at least watching at these queries.
1752
+
1753
+ 439
1754
+ 00:33:55,000 --> 00:33:56,000
1755
+ Click Apply Button.
1756
+
1757
+ 440
1758
+ 00:33:57,000 --> 00:34:03,000
1759
+ Now, when our query is applied, we can find our table on the tables in our databases.
1760
+
1761
+ 441
1762
+ 00:34:04,000 --> 00:34:07,000
1763
+ Let's expand that, and here's how I use our table.
1764
+
1765
+ 442
1766
+ 00:34:07,000 --> 00:34:09,000
1767
+ Congratulations.
1768
+
1769
+ 443
1770
+ 00:34:09,000 --> 00:34:11,000
1771
+ We have created our first table.
1772
+
1773
+ 444
1774
+ 00:34:12,000 --> 00:34:19,000
1775
+ The looks are zeroes, mouse, right click select rows, and you can see separate up was sequel query
1776
+
1777
+ 445
1778
+ 00:34:19,000 --> 00:34:22,000
1779
+ executed and representation of your table.
1780
+
1781
+ 446
1782
+ 00:34:22,000 --> 00:34:25,000
1783
+ You can play with the stable by entering different values.
1784
+
1785
+ 447
1786
+ 00:34:26,000 --> 00:34:27,000
1787
+ There are tensions.
1788
+
1789
+ 448
1790
+ 00:34:27,000 --> 00:34:34,000
1791
+ Its values in email column should be unique, and you don't need to populate the column because it is
1792
+
1793
+ 449
1794
+ 00:34:34,000 --> 00:34:35,000
1795
+ all the it.
1796
+
1797
+ 450
1798
+ 00:34:42,000 --> 00:34:49,000
1799
+ Once you adjust that table, click Apply button again, you will see preview of insert statements,
1800
+
1801
+ 451
1802
+ 00:34:49,000 --> 00:34:51,000
1803
+ click Apply one more time.
1804
+
1805
+ 452
1806
+ 00:34:52,000 --> 00:34:58,000
1807
+ And now you can see that I.D. values have been generated and pay attention to the format.
1808
+
1809
+ 453
1810
+ 00:34:58,000 --> 00:35:05,000
1811
+ The lengths of these five digits enumeration is going according to the regular number sequence, and
1812
+
1813
+ 454
1814
+ 00:35:05,000 --> 00:35:07,000
1815
+ the rest digits are filled with zero.
1816
+
1817
+ 455
1818
+ 00:35:08,000 --> 00:35:10,000
1819
+ That's what zero field property does.
1820
+
1821
+ 456
1822
+ 00:35:11,000 --> 00:35:15,000
1823
+ But to be honest, I don't use this option very often.
1824
+
1825
+ 457
1826
+ 00:35:15,000 --> 00:35:17,000
1827
+ But at least now you know what it does.
1828
+
1829
+ 458
1830
+ 00:35:18,000 --> 00:35:19,000
1831
+ Wow.
1832
+
1833
+ 459
1834
+ 00:35:19,000 --> 00:35:21,000
1835
+ We have learned a lot for the.
1836
+
1837
+ 460
1838
+ 00:35:21,000 --> 00:35:24,000
1839
+ Let's recap what we have learned in this lesson.
1840
+
1841
+ 461
1842
+ 00:35:25,000 --> 00:35:28,000
1843
+ In this lesson, we created our schema.
1844
+
1845
+ 462
1846
+ 00:35:28,000 --> 00:35:33,000
1847
+ We learned what charset and collation is and which one I recommend to use.
1848
+
1849
+ 463
1850
+ 00:35:34,000 --> 00:35:39,000
1851
+ You're in the lesson recovery topic of naming conventions for database objects.
1852
+
1853
+ 464
1854
+ 00:35:39,000 --> 00:35:43,000
1855
+ Now, you know, recommended rules to follow during the naming of schemas.
1856
+
1857
+ 465
1858
+ 00:35:43,000 --> 00:35:44,000
1859
+ Tables and columns.
1860
+
1861
+ 466
1862
+ 00:35:45,000 --> 00:35:48,000
1863
+ After this lesson, you know what search engines are.
1864
+
1865
+ 467
1866
+ 00:35:48,000 --> 00:35:54,000
1867
+ And you know, the difference between nine search engines in my school would have used different data
1868
+
1869
+ 468
1870
+ 00:35:54,000 --> 00:35:55,000
1871
+ types in my school.
1872
+
1873
+ 469
1874
+ 00:35:56,000 --> 00:36:02,000
1875
+ And at the end of the lesson, we learned column properties and create a table in database.
1876
+
1877
+ 470
1878
+ 00:36:02,000 --> 00:36:04,000
1879
+ Thanks a lot for your attention.
1880
+
1881
+ 471
1882
+ 00:36:04,000 --> 00:36:05,000
1883
+ Have a great day.
1884
+
1885
+ 472
1886
+ 00:36:05,000 --> 00:36:07,000
1887
+ See you in the next lesson.
1888
+
47 - Relational databases/003 Referential Integrity Foreign Key Constraint & Cascading Operations_en.srt ADDED
@@ -0,0 +1,1064 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:05,000 --> 00:00:06,000
3
+ Hello, Jim.
4
+
5
+ 2
6
+ 00:00:06,000 --> 00:00:12,000
7
+ Today we're going to proceed our practical activities combined with some new piece of theory.
8
+
9
+ 3
10
+ 00:00:12,000 --> 00:00:18,000
11
+ In this video, we proceed working with our first database tables that we created in the previous lesson.
12
+
13
+ 4
14
+ 00:00:19,000 --> 00:00:25,000
15
+ We are going to learn more about referential integrity, foreign key constraints and cascading operations.
16
+
17
+ 5
18
+ 00:00:26,000 --> 00:00:32,000
19
+ We'll start our lesson from understanding of referential integrity and potential consequences in case
20
+
21
+ 6
22
+ 00:00:32,000 --> 00:00:33,000
23
+ it will be broken.
24
+
25
+ 7
26
+ 00:00:33,000 --> 00:00:39,000
27
+ After that, we'll focus our attention on the solution for broken, referential integrity and how to
28
+
29
+ 8
30
+ 00:00:39,000 --> 00:00:41,000
31
+ what is happening in your database.
32
+
33
+ 9
34
+ 00:00:42,000 --> 00:00:48,000
35
+ We are going to review what cascading operations are and understand different types of cost-cutting
36
+
37
+ 10
38
+ 00:00:48,000 --> 00:00:49,000
39
+ operations.
40
+
41
+ 11
42
+ 00:00:49,000 --> 00:00:56,000
43
+ After that and practice, we are going to configure a foreign key constraint after review of all examples.
44
+
45
+ 12
46
+ 00:00:56,000 --> 00:01:02,000
47
+ And by the end of this lesson, I am sure you will understand such concepts as data consistency, data
48
+
49
+ 13
50
+ 00:01:02,000 --> 00:01:05,000
51
+ integrity, data quality and data validity.
52
+
53
+ 14
54
+ 00:01:06,000 --> 00:01:07,000
55
+ Let's start the lesson.
56
+
57
+ 15
58
+ 00:01:08,000 --> 00:01:14,000
59
+ And before we start altering our database table, let's try to understand problems that we are going
60
+
61
+ 16
62
+ 00:01:14,000 --> 00:01:15,000
63
+ to avoid.
64
+
65
+ 17
66
+ 00:01:15,000 --> 00:01:18,000
67
+ Let's talk about referential integrity.
68
+
69
+ 18
70
+ 00:01:19,000 --> 00:01:25,000
71
+ Referential integrity is one of the most important and mandatory property in the relational database
72
+
73
+ 19
74
+ 00:01:25,000 --> 00:01:28,000
75
+ that ensures that all references are valid.
76
+
77
+ 20
78
+ 00:01:29,000 --> 00:01:35,000
79
+ So in case one attribute of a relational table reference is the value of another attribute, then the
80
+
81
+ 21
82
+ 00:01:35,000 --> 00:01:38,000
83
+ reference value must exist.
84
+
85
+ 22
86
+ 00:01:39,000 --> 00:01:40,000
87
+ In simple words.
88
+
89
+ 23
90
+ 00:01:40,000 --> 00:01:48,000
91
+ Then it means that there are no references made by foreign keys to non-existent typos and to simplify
92
+
93
+ 24
94
+ 00:01:48,000 --> 00:01:49,000
95
+ it even more.
96
+
97
+ 25
98
+ 00:01:49,000 --> 00:01:52,000
99
+ It prohibits relations between tables using foreign keys.
100
+
101
+ 26
102
+ 00:01:53,000 --> 00:02:00,000
103
+ We have to be sure that foreign key is referencing to valid and existing data because otherwise it is
104
+
105
+ 27
106
+ 00:02:00,000 --> 00:02:07,000
107
+ not clear how to build relations between entities and case parent entity is not present in database
108
+
109
+ 28
110
+ 00:02:07,000 --> 00:02:08,000
111
+ anymore.
112
+
113
+ 29
114
+ 00:02:09,000 --> 00:02:11,000
115
+ Why referential integrity is important.
116
+
117
+ 30
118
+ 00:02:11,000 --> 00:02:16,000
119
+ There are different issues that mafia during the corruption of referential integrity.
120
+
121
+ 31
122
+ 00:02:17,000 --> 00:02:23,000
123
+ But the root cause of all issues is lost data because of corrupted integrity.
124
+
125
+ 32
126
+ 00:02:23,000 --> 00:02:31,000
127
+ A lack of referential integrity in the database can lead to incomplete data being churned, sometimes
128
+
129
+ 33
130
+ 00:02:31,000 --> 00:02:33,000
131
+ even with no indication of an error.
132
+
133
+ 34
134
+ 00:02:34,000 --> 00:02:41,000
135
+ This could result in the records being lost in the database because there's never a chance inquiries
136
+
137
+ 35
138
+ 00:02:41,000 --> 00:02:44,000
139
+ or reports, and the consequences might be different.
140
+
141
+ 36
142
+ 00:02:45,000 --> 00:02:50,000
143
+ Your existing queries may not transcend specific fields from other tables.
144
+
145
+ 37
146
+ 00:02:50,000 --> 00:02:58,000
147
+ Neurons across tune queries and this will produce some system error because the logic in court is usually
148
+
149
+ 38
150
+ 00:02:58,000 --> 00:03:04,000
151
+ built in rounds of data to modify it and to process and use some data is absent.
152
+
153
+ 39
154
+ 00:03:05,000 --> 00:03:07,000
155
+ Required logic is not triggered.
156
+
157
+ 40
158
+ 00:03:07,000 --> 00:03:16,000
159
+ So I want you to understand that this is not just data consistency issue referential integrity potentially
160
+
161
+ 41
162
+ 00:03:16,000 --> 00:03:19,000
163
+ may lead to not expected program behavior.
164
+
165
+ 42
166
+ 00:03:20,000 --> 00:03:25,000
167
+ Let's review example of a problem, and let's try to find a solution for it.
168
+
169
+ 43
170
+ 00:03:25,000 --> 00:03:27,000
171
+ Imagine that we have two tables.
172
+
173
+ 44
174
+ 00:03:28,000 --> 00:03:30,000
175
+ They are user and roll.
176
+
177
+ 45
178
+ 00:03:31,000 --> 00:03:33,000
179
+ Each user should have a role.
180
+
181
+ 46
182
+ 00:03:33,000 --> 00:03:38,000
183
+ It can be user admin or content editor or employee or client.
184
+
185
+ 47
186
+ 00:03:39,000 --> 00:03:44,000
187
+ There might be different roles here, but what is important?
188
+
189
+ 48
190
+ 00:03:44,000 --> 00:03:49,000
191
+ There is one too many relationships between the role table and user table.
192
+
193
+ 49
194
+ 00:03:49,000 --> 00:03:55,000
195
+ Each user may have only one role and each role may be assigned to multiple users.
196
+
197
+ 50
198
+ 00:03:56,000 --> 00:04:03,000
199
+ And now imagine that we decided to remove content editor role and we decided to introduce different
200
+
201
+ 51
202
+ 00:04:03,000 --> 00:04:07,000
203
+ roles in Step Media Editor and contributor.
204
+
205
+ 52
206
+ 00:04:08,000 --> 00:04:14,000
207
+ Well, not that depends a business domain, because anyway, I want you to focus not on the specific
208
+
209
+ 53
210
+ 00:04:14,000 --> 00:04:22,000
211
+ business issue, but on the technical one and step one of the role of TOPO is it contained information
212
+
213
+ 54
214
+ 00:04:22,000 --> 00:04:23,000
215
+ about content editor.
216
+
217
+ 55
218
+ 00:04:23,000 --> 00:04:27,000
219
+ What shall we do with foreign keys in our user table?
220
+
221
+ 56
222
+ 00:04:27,000 --> 00:04:31,000
223
+ They still reference to the table that doesn't exist anymore.
224
+
225
+ 57
226
+ 00:04:32,000 --> 00:04:33,000
227
+ Do understands the problem.
228
+
229
+ 58
230
+ 00:04:34,000 --> 00:04:41,000
231
+ In case I would need to get full name for all users, what will I get for users that have known about
232
+
233
+ 59
234
+ 00:04:41,000 --> 00:04:42,000
235
+ its reference?
236
+
237
+ 60
238
+ 00:04:42,000 --> 00:04:47,000
239
+ This is exactly the problem that is caused by corruption of referential integrity.
240
+
241
+ 61
242
+ 00:04:48,000 --> 00:04:53,000
243
+ How to prevent this happen, we need to set up foreign key constraint.
244
+
245
+ 62
246
+ 00:04:54,000 --> 00:04:56,000
247
+ Let's understand now what it is.
248
+
249
+ 63
250
+ 00:04:57,000 --> 00:05:03,000
251
+ The foreign key constraint is used to prevent actions that will destroy links between tables.
252
+
253
+ 64
254
+ 00:05:04,000 --> 00:05:11,000
255
+ A foreign key is a field or collection of fields in one table that refers to the primary key in another
256
+
257
+ 65
258
+ 00:05:11,000 --> 00:05:12,000
259
+ table.
260
+
261
+ 66
262
+ 00:05:12,000 --> 00:05:18,000
263
+ The table with foreign key is called the child table, and the table was the primary.
264
+
265
+ 67
266
+ 00:05:18,000 --> 00:05:22,000
267
+ Key is called the reference or parent table.
268
+
269
+ 68
270
+ 00:05:22,000 --> 00:05:29,000
271
+ In our particular example, user table contains column was named after a user role.
272
+
273
+ 69
274
+ 00:05:29,000 --> 00:05:36,000
275
+ This is exactly foreign key that allows us to build relationships between user and role tables.
276
+
277
+ 70
278
+ 00:05:37,000 --> 00:05:43,000
279
+ Now, let's think how we can figure that issue was foreign key constraint and how exactly it will prevent
280
+
281
+ 71
282
+ 00:05:43,000 --> 00:05:45,000
283
+ corruption of referential integrity.
284
+
285
+ 72
286
+ 00:05:46,000 --> 00:05:51,000
287
+ Let me suggest a few ideas how to avoid corruption of referential integrity.
288
+
289
+ 73
290
+ 00:05:51,000 --> 00:05:59,000
291
+ The first option is just to forbid removal and the date of Toptal in case some other tables contains
292
+
293
+ 74
294
+ 00:05:59,000 --> 00:06:00,000
295
+ a reference to it.
296
+
297
+ 75
298
+ 00:06:00,000 --> 00:06:08,000
299
+ In this case, we can't remove content editor role or update its I-D until some references exist.
300
+
301
+ 76
302
+ 00:06:09,000 --> 00:06:12,000
303
+ The second option is to remove all related records.
304
+
305
+ 77
306
+ 00:06:12,000 --> 00:06:19,000
307
+ For example, if I remove content editor role, then keeping content editor users in the system makes
308
+
309
+ 78
310
+ 00:06:19,000 --> 00:06:22,000
311
+ no sense, and I also remove related users.
312
+
313
+ 79
314
+ 00:06:23,000 --> 00:06:31,000
315
+ Now, imagine that instead of removing Content Editor, you just decided to update it and you change
316
+
317
+ 80
318
+ 00:06:31,000 --> 00:06:33,000
319
+ the primary key and the role name.
320
+
321
+ 81
322
+ 00:06:33,000 --> 00:06:37,000
323
+ In this case, we update all references was updated primary key.
324
+
325
+ 82
326
+ 00:06:38,000 --> 00:06:42,000
327
+ Another option is to set null values instead of all references.
328
+
329
+ 83
330
+ 00:06:43,000 --> 00:06:50,000
331
+ You may also consider this option, but again, in this case, you have to have logical place that process
332
+
333
+ 84
334
+ 00:06:50,000 --> 00:06:54,000
335
+ null values that you would receive in response instead of required data.
336
+
337
+ 85
338
+ 00:06:55,000 --> 00:07:02,000
339
+ And all value is a special marker used in school to indicate that a data value doesn't exist in the
340
+
341
+ 86
342
+ 00:07:02,000 --> 00:07:03,000
343
+ database.
344
+
345
+ 87
346
+ 00:07:04,000 --> 00:07:11,000
347
+ In other words, it is just a placeholder to denote values that missing was that we don't know.
348
+
349
+ 88
350
+ 00:07:12,000 --> 00:07:19,000
351
+ And last but not least, is setting default value instead of all references, for example, in this
352
+
353
+ 89
354
+ 00:07:19,000 --> 00:07:22,000
355
+ case, one content editor role has been removed.
356
+
357
+ 90
358
+ 00:07:23,000 --> 00:07:26,000
359
+ We can set default reference to employee role records.
360
+
361
+ 91
362
+ 00:07:27,000 --> 00:07:34,000
363
+ That means that all references to Content Editor role will be substituted with references to employee
364
+
365
+ 92
366
+ 00:07:34,000 --> 00:07:34,000
367
+ role.
368
+
369
+ 93
370
+ 00:07:36,000 --> 00:07:39,000
371
+ All these options are called cascading operations.
372
+
373
+ 94
374
+ 00:07:40,000 --> 00:07:47,000
375
+ These operations are special kind of database restrictions that describe his behavior in case of removal
376
+
377
+ 95
378
+ 00:07:47,000 --> 00:07:53,000
379
+ record from parent table or in case updating of its primary key.
380
+
381
+ 96
382
+ 00:07:53,000 --> 00:07:54,000
383
+ Does it make sense?
384
+
385
+ 97
386
+ 00:07:55,000 --> 00:08:02,000
387
+ And then the lesson we are going to learn how to set up these restrictions in our table on practice.
388
+
389
+ 98
390
+ 00:08:03,000 --> 00:08:10,000
391
+ So to sum it up, we can configure foreign key constraint on update or on the lead off primary key in
392
+
393
+ 99
394
+ 00:08:10,000 --> 00:08:11,000
395
+ parent table.
396
+
397
+ 100
398
+ 00:08:12,000 --> 00:08:17,000
399
+ Foreign key constraint may be of the following types restrict.
400
+
401
+ 101
402
+ 00:08:17,000 --> 00:08:25,000
403
+ This restricts any cost current operations, so we have to make sure first that we removed all references
404
+
405
+ 102
406
+ 00:08:25,000 --> 00:08:33,000
407
+ to this table and only after that remove or update the primary key in parent table cascade.
408
+
409
+ 103
410
+ 00:08:34,000 --> 00:08:41,000
411
+ This option will update foreign key in child tables in case it was updated and will remove double from
412
+
413
+ 104
414
+ 00:08:41,000 --> 00:08:46,000
415
+ child table in case primary key and parent table has been removed.
416
+
417
+ 105
418
+ 00:08:46,000 --> 00:08:53,000
419
+ Set now based on the name, you can make an assumption what does assumption that it sets?
420
+
421
+ 106
422
+ 00:08:53,000 --> 00:08:58,000
423
+ Now, instead of foreign key, it's the last one was either updated or removed.
424
+
425
+ 107
426
+ 00:08:59,000 --> 00:09:00,000
427
+ No action.
428
+
429
+ 108
430
+ 00:09:01,000 --> 00:09:03,000
431
+ Is this a so-so options of disposable tissues?
432
+
433
+ 109
434
+ 00:09:03,000 --> 00:09:10,000
435
+ But I'm not sure whether you will need it, because the whole idea of foreign key constraint is to set
436
+
437
+ 110
438
+ 00:09:10,000 --> 00:09:16,000
439
+ up a constraint, but not just select no action option and ignore things, said default.
440
+
441
+ 111
442
+ 00:09:17,000 --> 00:09:21,000
443
+ You can substitute reference to the foreign key was the default value.
444
+
445
+ 112
446
+ 00:09:22,000 --> 00:09:28,000
447
+ While this is also one of the foreign key constraints, you won't be able to find this option in my
448
+
449
+ 113
450
+ 00:09:28,000 --> 00:09:29,000
451
+ school workbench.
452
+
453
+ 114
454
+ 00:09:30,000 --> 00:09:37,000
455
+ Also, you wouldn't be able to set said default option or be a sequel query because it is simply not
456
+
457
+ 115
458
+ 00:09:37,000 --> 00:09:41,000
459
+ supported by inadequate storage engine in my school.
460
+
461
+ 116
462
+ 00:09:41,000 --> 00:09:47,000
463
+ Still, there is a workaround was usage of triggers in my school, but we haven't learned how to work
464
+
465
+ 117
466
+ 00:09:47,000 --> 00:09:49,000
467
+ with triggers in a separate lesson.
468
+
469
+ 118
470
+ 00:09:50,000 --> 00:09:53,000
471
+ And now there's exactly time for the live demo.
472
+
473
+ 119
474
+ 00:09:53,000 --> 00:09:56,000
475
+ Let's learn in practice how to set foreign key constraint.
476
+
477
+ 120
478
+ 00:09:58,000 --> 00:10:05,000
479
+ Bruce Larson, we created with you user table in case you didn't watch that lesson and don't know how
480
+
481
+ 121
482
+ 00:10:05,000 --> 00:10:06,000
483
+ to create tables.
484
+
485
+ 122
486
+ 00:10:06,000 --> 00:10:09,000
487
+ Please watch it if you have a user table.
488
+
489
+ 123
490
+ 00:10:10,000 --> 00:10:13,000
491
+ We are going to proceed for the sake of the demo.
492
+
493
+ 124
494
+ 00:10:13,000 --> 00:10:15,000
495
+ We need one more table.
496
+
497
+ 125
498
+ 00:10:15,000 --> 00:10:17,000
499
+ Let's create role table now.
500
+
501
+ 126
502
+ 00:10:18,000 --> 00:10:23,000
503
+ I already created this table before the lesson to save the time during the video lesson.
504
+
505
+ 127
506
+ 00:10:24,000 --> 00:10:30,000
507
+ If you need time to create a table grasp, pause for a minute and then resume VIDEO when you are ready.
508
+
509
+ 128
510
+ 00:10:31,000 --> 00:10:33,000
511
+ This table has only two fields.
512
+
513
+ 129
514
+ 00:10:33,000 --> 00:10:36,000
515
+ They are ID and role name.
516
+
517
+ 130
518
+ 00:10:36,000 --> 00:10:37,000
519
+ That's it.
520
+
521
+ 131
522
+ 00:10:38,000 --> 00:10:42,000
523
+ When you created this table, please calculated, was valleys.
524
+
525
+ 132
526
+ 00:10:42,000 --> 00:10:45,000
527
+ It is not critically important what would be a role name?
528
+
529
+ 133
530
+ 00:10:46,000 --> 00:10:50,000
531
+ The main thing here is to have at least a few roles for demo purposes.
532
+
533
+ 134
534
+ 00:10:51,000 --> 00:10:57,000
535
+ If you wish, you can create the values as I have, and when you add its values into the role table,
536
+
537
+ 135
538
+ 00:10:58,000 --> 00:10:59,000
539
+ we are done with it.
540
+
541
+ 136
542
+ 00:10:59,000 --> 00:11:05,000
543
+ And again, if you don't know how to add value in table, we are my school workbench.
544
+
545
+ 137
546
+ 00:11:06,000 --> 00:11:08,000
547
+ Please refer to the previous lesson.
548
+
549
+ 138
550
+ 00:11:09,000 --> 00:11:13,000
551
+ Now we need to establish relationships between the role and user tables.
552
+
553
+ 139
554
+ 00:11:14,000 --> 00:11:20,000
555
+ If you remember lesson about relational database basic concepts, then you should remember that one
556
+
557
+ 140
558
+ 00:11:20,000 --> 00:11:25,000
559
+ too many relationships is implemented by adding foreign key into another table.
560
+
561
+ 141
562
+ 00:11:26,000 --> 00:11:28,000
563
+ We need to adjust our user table now.
564
+
565
+ 142
566
+ 00:11:29,000 --> 00:11:35,000
567
+ I do mouse right click on the user table and I select Alter Table Option.
568
+
569
+ 143
570
+ 00:11:35,000 --> 00:11:40,000
571
+ In this view, we need to add one more column for foreign key.
572
+
573
+ 144
574
+ 00:11:40,000 --> 00:11:47,000
575
+ There is an agreed naming convention for the name of the foreign key, while you still can name it as
576
+
577
+ 145
578
+ 00:11:47,000 --> 00:11:48,000
579
+ you want.
580
+
581
+ 146
582
+ 00:11:48,000 --> 00:11:57,000
583
+ I would recommend you two fellows and next partner f k that stands for foreign key, followed by Underscore,
584
+
585
+ 147
586
+ 00:11:58,000 --> 00:12:00,000
587
+ followed by foreign key table name.
588
+
589
+ 148
590
+ 00:12:00,000 --> 00:12:06,000
591
+ In our case for table name is a target table xCurrent one.
592
+
593
+ 149
594
+ 00:12:06,000 --> 00:12:14,000
595
+ Thus, I like to use R after f k after that again goes underscore, and this time it is followed by
596
+
597
+ 150
598
+ 00:12:14,000 --> 00:12:16,000
599
+ primary key table.
600
+
601
+ 151
602
+ 00:12:16,000 --> 00:12:20,000
603
+ This is our source table in this particular case.
604
+
605
+ 152
606
+ 00:12:20,000 --> 00:12:22,000
607
+ This is roll table.
608
+
609
+ 153
610
+ 00:12:23,000 --> 00:12:28,000
611
+ This is why we have such name for a foreign key column f k user role.
612
+
613
+ 154
614
+ 00:12:29,000 --> 00:12:36,000
615
+ Considering that we use surrogate primary key in the role table, we have to use each type for the foreign
616
+
617
+ 155
618
+ 00:12:36,000 --> 00:12:37,000
619
+ key column to.
620
+
621
+ 156
622
+ 00:12:39,000 --> 00:12:44,000
623
+ When we are done with creation of the calling for the foreign key, let's open another tap.
624
+
625
+ 157
626
+ 00:12:44,000 --> 00:12:46,000
627
+ I open foreign key staff.
628
+
629
+ 158
630
+ 00:12:47,000 --> 00:12:52,000
631
+ This is exactly the type where we can configure foreign key constraint on the database level.
632
+
633
+ 159
634
+ 00:12:53,000 --> 00:12:55,000
635
+ Specify foreign key name.
636
+
637
+ 160
638
+ 00:12:55,000 --> 00:13:00,000
639
+ This is just a name for foreign key constraint in reference tables.
640
+
641
+ 161
642
+ 00:13:00,000 --> 00:13:03,000
643
+ Select the parent table the tables.
644
+
645
+ 162
646
+ 00:13:03,000 --> 00:13:10,000
647
+ It contains primary keys that we are referencing to, and after that you have opportunity to select.
648
+
649
+ 163
650
+ 00:13:10,000 --> 00:13:16,000
651
+ The column was foreign key in the current table and specify reference column in the parent table.
652
+
653
+ 164
654
+ 00:13:17,000 --> 00:13:20,000
655
+ Now why do we consider that connection?
656
+
657
+ 165
658
+ 00:13:20,000 --> 00:13:23,000
659
+ Let me specify foreign key options here.
660
+
661
+ 166
662
+ 00:13:23,000 --> 00:13:30,000
663
+ Usually, you can specify constraints on update and on delete operations in parenting mode for the sake
664
+
665
+ 167
666
+ 00:13:30,000 --> 00:13:31,000
667
+ of the demo.
668
+
669
+ 168
670
+ 00:13:31,000 --> 00:13:34,000
671
+ Let me set restrict options here.
672
+
673
+ 169
674
+ 00:13:34,000 --> 00:13:36,000
675
+ I click apply by them.
676
+
677
+ 170
678
+ 00:13:36,000 --> 00:13:40,000
679
+ You also can check SQL queries it is going to be executed.
680
+
681
+ 171
682
+ 00:13:41,000 --> 00:13:44,000
683
+ Don't worry, one will come to learn in the sequel.
684
+
685
+ 172
686
+ 00:13:44,000 --> 00:13:47,000
687
+ We are going to also cover alter table queries.
688
+
689
+ 173
690
+ 00:13:47,000 --> 00:13:51,000
691
+ But still, it is good for you to be at least familiar with squares.
692
+
693
+ 174
694
+ 00:13:52,000 --> 00:13:59,000
695
+ My concept of the Asian database is to let you understand operations that we need to execute against
696
+
697
+ 175
698
+ 00:13:59,000 --> 00:14:02,000
699
+ database and when we need to execute them.
700
+
701
+ 176
702
+ 00:14:02,000 --> 00:14:11,000
703
+ This gives my students understanding of end to end flow, and one will understand this will go to details
704
+
705
+ 177
706
+ 00:14:11,000 --> 00:14:13,000
707
+ and will learn SQL itself.
708
+
709
+ 178
710
+ 00:14:13,000 --> 00:14:18,000
711
+ I hope this approach will also help you to learn the topic faster.
712
+
713
+ 179
714
+ 00:14:19,000 --> 00:14:27,000
715
+ In our user, a table, we have new fields now, let's put foreign keys for each user just to help you
716
+
717
+ 180
718
+ 00:14:27,000 --> 00:14:34,000
719
+ understand I I.D. of Topo from rolls table to establish one to many relationships.
720
+
721
+ 181
722
+ 00:14:35,000 --> 00:14:39,000
723
+ It isn't critically important in which one role will be assigned to each user.
724
+
725
+ 182
726
+ 00:14:40,000 --> 00:14:45,000
727
+ Since this is all fake data, that's why I put these in random order.
728
+
729
+ 183
730
+ 00:14:45,000 --> 00:14:50,000
731
+ Here is the interest in seeing the demo in roundtable.
732
+
733
+ 184
734
+ 00:14:50,000 --> 00:14:56,000
735
+ We have maximum and equal to six basically Z values from one to six.
736
+
737
+ 185
738
+ 00:14:57,000 --> 00:15:05,000
739
+ What will happen if I would try to set, for example, value 10 in foreign key column, I put Dan and
740
+
741
+ 186
742
+ 00:15:06,000 --> 00:15:07,000
743
+ click Apply.
744
+
745
+ 187
746
+ 00:15:08,000 --> 00:15:13,000
747
+ You can see that the reason there because was set, that'd be something like this.
748
+
749
+ 188
750
+ 00:15:13,000 --> 00:15:18,000
751
+ This database, I want to establish relationships between two tables.
752
+
753
+ 189
754
+ 00:15:18,000 --> 00:15:23,000
755
+ And this column will be used as foreign key to reference the parent table primary key.
756
+
757
+ 190
758
+ 00:15:24,000 --> 00:15:29,000
759
+ And our database listen to us and do what we asked it to do.
760
+
761
+ 191
762
+ 00:15:29,000 --> 00:15:36,000
763
+ That's why you can't add reference to non-existent primary key and parent table.
764
+
765
+ 192
766
+ 00:15:37,000 --> 00:15:38,000
767
+ Let me open the roll table.
768
+
769
+ 193
770
+ 00:15:39,000 --> 00:15:45,000
771
+ In case I'd like to remove all the participating relationships was record from another table.
772
+
773
+ 194
774
+ 00:15:45,000 --> 00:15:47,000
775
+ I wouldn't be able to do that.
776
+
777
+ 195
778
+ 00:15:48,000 --> 00:15:51,000
779
+ I can't do miles right click on the road and select the lead role.
780
+
781
+ 196
782
+ 00:15:52,000 --> 00:16:00,000
783
+ After that, I click Apply button that the base doesn't let me remove zero because we restrict its removal
784
+
785
+ 197
786
+ 00:16:00,000 --> 00:16:04,000
787
+ in this case, if you want to remove Roe was a new one.
788
+
789
+ 198
790
+ 00:16:04,000 --> 00:16:11,000
791
+ We have to remove all references to this record in other tables, and only after that we will be able
792
+
793
+ 199
794
+ 00:16:11,000 --> 00:16:14,000
795
+ to remove this rule does it make sense.
796
+
797
+ 200
798
+ 00:16:15,000 --> 00:16:19,000
799
+ So our SQL query wasn't executed successfully.
800
+
801
+ 201
802
+ 00:16:19,000 --> 00:16:22,000
803
+ That's why I click on Execute Query.
804
+
805
+ 202
806
+ 00:16:22,000 --> 00:16:27,000
807
+ I can hear one more time, and here's our row back again.
808
+
809
+ 203
810
+ 00:16:28,000 --> 00:16:35,000
811
+ It is still stored in Libby and is always guys not shy to ask questions and comments on this, we knew
812
+
813
+ 204
814
+ 00:16:35,000 --> 00:16:36,000
815
+ in case you have any.
816
+
817
+ 205
818
+ 00:16:37,000 --> 00:16:39,000
819
+ I always will be happy to answer.
820
+
821
+ 206
822
+ 00:16:40,000 --> 00:16:47,000
823
+ Now, let's demo another thing I need to all to use a table one more time to demo you and not just sing.
824
+
825
+ 207
826
+ 00:16:48,000 --> 00:16:55,000
827
+ Now, in certain key options, I'm going to select Cascade, what we expect now on that date.
828
+
829
+ 208
830
+ 00:16:55,000 --> 00:16:58,000
831
+ Foreign key should be updated on remove.
832
+
833
+ 209
834
+ 00:16:58,000 --> 00:17:00,000
835
+ Related records will be removed.
836
+
837
+ 210
838
+ 00:17:01,000 --> 00:17:06,000
839
+ Let's get back to the table in his updated primary key for one record.
840
+
841
+ 211
842
+ 00:17:07,000 --> 00:17:09,000
843
+ It will be updated in another table.
844
+
845
+ 212
846
+ 00:17:13,000 --> 00:17:15,000
847
+ Let me open user table now.
848
+
849
+ 213
850
+ 00:17:16,000 --> 00:17:21,000
851
+ You also can see that foreign key has been changed once I refreshed table.
852
+
853
+ 214
854
+ 00:17:22,000 --> 00:17:28,000
855
+ So refresh table, you need to execute select queries, it was prepared by my school workbench one more
856
+
857
+ 215
858
+ 00:17:28,000 --> 00:17:28,000
859
+ time.
860
+
861
+ 216
862
+ 00:17:29,000 --> 00:17:34,000
863
+ Let me open the roll table again and let me remove zero plays its role.
864
+
865
+ 217
866
+ 00:17:35,000 --> 00:17:39,000
867
+ I execute this query, no error so far.
868
+
869
+ 218
870
+ 00:17:39,000 --> 00:17:46,000
871
+ And once this query is executed and Temple is removed from parent table with triggered cascading operation
872
+
873
+ 219
874
+ 00:17:46,000 --> 00:17:49,000
875
+ in a related table on the delete event.
876
+
877
+ 220
878
+ 00:17:49,000 --> 00:17:53,000
879
+ All related rows should be also removed in cascade cascading manner.
880
+
881
+ 221
882
+ 00:17:54,000 --> 00:17:59,000
883
+ Let me refresh your user table and you can see that throws the reference to the tackles that we have
884
+
885
+ 222
886
+ 00:17:59,000 --> 00:18:01,000
887
+ just removed is also removed.
888
+
889
+ 223
890
+ 00:18:02,000 --> 00:18:04,000
891
+ Let's adjust foreign key constraint.
892
+
893
+ 224
894
+ 00:18:04,000 --> 00:18:07,000
895
+ And this time we'll select said no.
896
+
897
+ 225
898
+ 00:18:13,000 --> 00:18:15,000
899
+ Once we apply, it all changes.
900
+
901
+ 226
902
+ 00:18:15,000 --> 00:18:22,000
903
+ I assume you can understand what will happen in case a remove role in parent table or update primer
904
+
905
+ 227
906
+ 00:18:22,000 --> 00:18:26,000
907
+ key Zen related values in foreign key will be set up.
908
+
909
+ 228
910
+ 00:18:27,000 --> 00:18:33,000
911
+ That's all possible because current operations is that you can perform in my school in tables was not
912
+
913
+ 229
914
+ 00:18:33,000 --> 00:18:34,000
915
+ in the engine.
916
+
917
+ 230
918
+ 00:18:34,000 --> 00:18:35,000
919
+ I don't know them.
920
+
921
+ 231
922
+ 00:18:35,000 --> 00:18:38,000
923
+ You last for restrictions at the schools.
924
+
925
+ 232
926
+ 00:18:38,000 --> 00:18:43,000
927
+ No action because I assume you are smart enough to understand what will happen.
928
+
929
+ 233
930
+ 00:18:44,000 --> 00:18:50,000
931
+ And if you want to remove foreign key constraint, just open table configurations by selecting all the
932
+
933
+ 234
934
+ 00:18:50,000 --> 00:18:57,000
935
+ table one more time and click the lead, select it on the foreign key constraint and take the kids query.
936
+
937
+ 235
938
+ 00:18:57,000 --> 00:18:58,000
939
+ That's it.
940
+
941
+ 236
942
+ 00:18:59,000 --> 00:19:05,000
943
+ On this example, I believe you already understood what data, consistency and data validity means.
944
+
945
+ 237
946
+ 00:19:06,000 --> 00:19:11,000
947
+ In other words, this is nothing more than referential integrity and internal consistency.
948
+
949
+ 238
950
+ 00:19:12,000 --> 00:19:19,000
951
+ Data consistency means that there is consistency in measurement of variables throughout data sets.
952
+
953
+ 239
954
+ 00:19:20,000 --> 00:19:28,000
955
+ Data integrity is the overall accuracy and consistency of data and database can be set to be data consistent.
956
+
957
+ 240
958
+ 00:19:28,000 --> 00:19:36,000
959
+ Once the content and the question doesn't give us a chance to infer a contradiction directly or indirectly,
960
+
961
+ 241
962
+ 00:19:37,000 --> 00:19:41,000
963
+ data can be entirely consistent, but entirely wrong.
964
+
965
+ 242
966
+ 00:19:41,000 --> 00:19:46,000
967
+ So the phrase data integrity is about the quality of data.
968
+
969
+ 243
970
+ 00:19:46,000 --> 00:19:53,000
971
+ Database management systems provide data consistency tools, which can help around data integrity.
972
+
973
+ 244
974
+ 00:19:54,000 --> 00:20:00,000
975
+ These are the parameters which are used to indicate the condition of data, such as data quality.
976
+
977
+ 245
978
+ 00:20:01,000 --> 00:20:04,000
979
+ Data quality is a measurement of the condition of data.
980
+
981
+ 246
982
+ 00:20:04,000 --> 00:20:12,000
983
+ Considering factors such as accuracy, completeness, consistency, data integrity is not about data
984
+
985
+ 247
986
+ 00:20:12,000 --> 00:20:13,000
987
+ quality.
988
+
989
+ 248
990
+ 00:20:13,000 --> 00:20:20,000
991
+ Data quality answer some questions, such as meetings or defined standards of an organization.
992
+
993
+ 249
994
+ 00:20:20,000 --> 00:20:23,000
995
+ Data quality is a part of data integrity.
996
+
997
+ 250
998
+ 00:20:24,000 --> 00:20:32,000
999
+ Data integrity includes all aspects of data quality and also force rules and includes review one more
1000
+
1001
+ 251
1002
+ 00:20:32,000 --> 00:20:34,000
1003
+ term like data validity.
1004
+
1005
+ 252
1006
+ 00:20:35,000 --> 00:20:41,000
1007
+ It is worth to say that this is just an aspect of data quality consistent in its settings.
1008
+
1009
+ 253
1010
+ 00:20:41,000 --> 00:20:46,000
1011
+ This is a natural process of data obsolescence increase in time.
1012
+
1013
+ 254
1014
+ 00:20:47,000 --> 00:20:48,000
1015
+ Stay tuned.
1016
+
1017
+ 255
1018
+ 00:20:48,000 --> 00:20:54,000
1019
+ We'll have a lot of lessons where we'll discuss tools and techniques to ensure the best data quality.
1020
+
1021
+ 256
1022
+ 00:20:54,000 --> 00:20:56,000
1023
+ That's all for this lesson.
1024
+
1025
+ 257
1026
+ 00:20:56,000 --> 00:21:03,000
1027
+ Let's recap what we have learned today in this lesson, we have learned what referential integrity is
1028
+
1029
+ 258
1030
+ 00:21:03,000 --> 00:21:04,000
1031
+ now.
1032
+
1033
+ 259
1034
+ 00:21:04,000 --> 00:21:07,000
1035
+ You know what consequences of broken, referential integrity are.
1036
+
1037
+ 260
1038
+ 00:21:08,000 --> 00:21:13,000
1039
+ We learned the concept of cascading operations and practice activities.
1040
+
1041
+ 261
1042
+ 00:21:13,000 --> 00:21:16,000
1043
+ We can figure foreign key constraint in our tables.
1044
+
1045
+ 262
1046
+ 00:21:16,000 --> 00:21:22,000
1047
+ I am sure that after this lesson, you have a clear understanding of what data consistency, data integrity,
1048
+
1049
+ 263
1050
+ 00:21:23,000 --> 00:21:25,000
1051
+ data quality and data related to is.
1052
+
1053
+ 264
1054
+ 00:21:26,000 --> 00:21:27,000
1055
+ Thanks a lot for your attention.
1056
+
1057
+ 265
1058
+ 00:21:28,000 --> 00:21:29,000
1059
+ Have a great day.
1060
+
1061
+ 266
1062
+ 00:21:29,000 --> 00:21:31,000
1063
+ See you in the next lesson.
1064
+
47 - Relational databases/004 Indexes in Databases_en.srt ADDED
@@ -0,0 +1,988 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:05,000 --> 00:00:06,000
3
+ Hello.
4
+
5
+ 2
6
+ 00:00:06,000 --> 00:00:10,000
7
+ Yes, tenants in this lesson, we're going to learn indexes and databases.
8
+
9
+ 3
10
+ 00:00:10,000 --> 00:00:13,000
11
+ I will explain you what they are and why we need them.
12
+
13
+ 4
14
+ 00:00:14,000 --> 00:00:16,000
15
+ Also, we'll have practiced during the lesson.
16
+
17
+ 5
18
+ 00:00:16,000 --> 00:00:22,000
19
+ We'll create a few indexes for our existing tables that we created in previous videos.
20
+
21
+ 6
22
+ 00:00:23,000 --> 00:00:28,000
23
+ In the lesson, we're going to learn definition of index, and I will explain you what it is.
24
+
25
+ 7
26
+ 00:00:28,000 --> 00:00:32,000
27
+ One example you're going to understand why we need indexes.
28
+
29
+ 8
30
+ 00:00:33,000 --> 00:00:40,000
31
+ Also, we're going to give you a different index types Ziya primary, secondary and clustering.
32
+
33
+ 9
34
+ 00:00:41,000 --> 00:00:45,000
35
+ Also, we're going to have a practice during the lesson in my school workbench.
36
+
37
+ 10
38
+ 00:00:45,000 --> 00:00:51,000
39
+ We're going to learn how to create indexes kind of figures, work with different properties and delays.
40
+
41
+ 11
42
+ 00:00:52,000 --> 00:00:58,000
43
+ And as a summary, at the end of the lesson, we're going to review advantages and disadvantages of
44
+
45
+ 12
46
+ 00:00:58,000 --> 00:00:59,000
47
+ using indexes.
48
+
49
+ 13
50
+ 00:01:00,000 --> 00:01:01,000
51
+ Let's start our lesson.
52
+
53
+ 14
54
+ 00:01:02,000 --> 00:01:10,000
55
+ We're going to start our lesson with definition of indexes, so what indexes indexes, the data structures,
56
+
57
+ 15
58
+ 00:01:10,000 --> 00:01:17,000
59
+ it improves the speed of data retrieval operations on a database table and the cost of additional rights
60
+
61
+ 16
62
+ 00:01:17,000 --> 00:01:18,000
63
+ and storage space.
64
+
65
+ 17
66
+ 00:01:19,000 --> 00:01:21,000
67
+ The main things are index data structure.
68
+
69
+ 18
70
+ 00:01:22,000 --> 00:01:28,000
71
+ Indexes are used to quickly allocate data without having to search every row in a database table.
72
+
73
+ 19
74
+ 00:01:28,000 --> 00:01:31,000
75
+ Every time and database table is accessed.
76
+
77
+ 20
78
+ 00:01:32,000 --> 00:01:40,000
79
+ Indexes can be created using one or more columns of a database table provides a basis for both rapid
80
+
81
+ 21
82
+ 00:01:40,000 --> 00:01:47,000
83
+ random lookups, and the efficient access of order records in the minutes will explain what lookups
84
+
85
+ 22
86
+ 00:01:47,000 --> 00:01:49,000
87
+ are then distant.
88
+
89
+ 23
90
+ 00:01:49,000 --> 00:01:50,000
91
+ What is an index?
92
+
93
+ 24
94
+ 00:01:51,000 --> 00:01:56,000
95
+ In most simple words, and index is a small table having only two columns.
96
+
97
+ 25
98
+ 00:01:56,000 --> 00:02:00,000
99
+ The first column is a copy of the primary key off a table.
100
+
101
+ 26
102
+ 00:02:00,000 --> 00:02:08,000
103
+ The second column contains a set of pointers for holding the address of the disk block, whereas it's
104
+
105
+ 27
106
+ 00:02:08,000 --> 00:02:10,000
107
+ specific related to accurate is stored.
108
+
109
+ 28
110
+ 00:02:11,000 --> 00:02:14,000
111
+ In some cases, index is sorted and extracted.
112
+
113
+ 29
114
+ 00:02:14,000 --> 00:02:18,000
115
+ The reference to the records become easier thing to do.
116
+
117
+ 30
118
+ 00:02:18,000 --> 00:02:23,000
119
+ An operation is significantly faster rather than going over each row.
120
+
121
+ 31
122
+ 00:02:24,000 --> 00:02:28,000
123
+ Before we move further was none of indexes in details.
124
+
125
+ 32
126
+ 00:02:28,000 --> 00:02:34,000
127
+ I promised you to explain what lookup tables are in computer science.
128
+
129
+ 33
130
+ 00:02:34,000 --> 00:02:41,000
131
+ A lookup table isn't the rate that replaces runtime computation with a simpler rate indexing operation.
132
+
133
+ 34
134
+ 00:02:42,000 --> 00:02:49,000
135
+ The savings in processing time can be significant because retrieving a value from memory is often faster
136
+
137
+ 35
138
+ 00:02:49,000 --> 00:02:54,000
139
+ than carrying out an expensive computation or input output operation.
140
+
141
+ 36
142
+ 00:02:55,000 --> 00:02:59,000
143
+ The tables may be calculated and stored in static storage.
144
+
145
+ 37
146
+ 00:03:00,000 --> 00:03:06,000
147
+ This assumption doesn't require for a separate lesson, but still important for you to know this chunk.
148
+
149
+ 38
150
+ 00:03:07,000 --> 00:03:14,000
151
+ Sometimes you're going to create such lookup tables or just how easy called lookups in your database
152
+
153
+ 39
154
+ 00:03:15,000 --> 00:03:21,000
155
+ and definitely indexing will help you significantly improve performance of your app by reducing the
156
+
157
+ 40
158
+ 00:03:21,000 --> 00:03:24,000
159
+ time of computation to find the value you need.
160
+
161
+ 41
162
+ 00:03:25,000 --> 00:03:30,000
163
+ That was a small step aside to make sure you understood all terms I mentioned.
164
+
165
+ 42
166
+ 00:03:31,000 --> 00:03:36,000
167
+ Let's understand now in more detail what does indexing do and why?
168
+
169
+ 43
170
+ 00:03:36,000 --> 00:03:39,000
171
+ It is important and deserves a separate lesson.
172
+
173
+ 44
174
+ 00:03:40,000 --> 00:03:47,000
175
+ Indexing is a way to get an order table into an order that will maximize the query efficiency.
176
+
177
+ 45
178
+ 00:03:47,000 --> 00:03:55,000
179
+ While searching one table is an index is the order of the rows will likely not to be discernable by
180
+
181
+ 46
182
+ 00:03:55,000 --> 00:04:03,000
183
+ the query as optimized in any way, and your query will therefore have to search through the rows leniently.
184
+
185
+ 47
186
+ 00:04:03,000 --> 00:04:10,000
187
+ In other words, the queries will have to search through every rule to find zeros matching the conditions.
188
+
189
+ 48
190
+ 00:04:11,000 --> 00:04:14,000
191
+ As you can imagine, this can take a long time.
192
+
193
+ 49
194
+ 00:04:14,000 --> 00:04:18,000
195
+ Looking through every single row is not very efficient.
196
+
197
+ 50
198
+ 00:04:18,000 --> 00:04:26,000
199
+ Imagine that you have a list of users in your database and that 100000 of them and you need to find
200
+
201
+ 51
202
+ 00:04:26,000 --> 00:04:27,000
203
+ the user by its email.
204
+
205
+ 52
206
+ 00:04:28,000 --> 00:04:34,000
207
+ You can pass users email as a search query to a database, but to find zeros.
208
+
209
+ 53
210
+ 00:04:34,000 --> 00:04:36,000
211
+ It's a unique database will go over each row.
212
+
213
+ 54
214
+ 00:04:36,000 --> 00:04:41,000
215
+ Compare and email in a search query was the actual email in each table.
216
+
217
+ 55
218
+ 00:04:42,000 --> 00:04:45,000
219
+ How much time will it take to iterate over each couple?
220
+
221
+ 56
222
+ 00:04:46,000 --> 00:04:46,000
223
+ Would this soon?
224
+
225
+ 57
226
+ 00:04:47,000 --> 00:04:55,000
227
+ Well, believe me, it will take time in the sense of post to improve the performance of the database
228
+
229
+ 58
230
+ 00:04:55,000 --> 00:05:00,000
231
+ while reading data from an index causes the database to create a data structure.
232
+
233
+ 59
234
+ 00:05:01,000 --> 00:05:07,000
235
+ In this data structure, with a search term and pointer to the actual records in the database, for
236
+
237
+ 60
238
+ 00:05:07,000 --> 00:05:11,000
239
+ example, index can be created for email column.
240
+
241
+ 61
242
+ 00:05:11,000 --> 00:05:16,000
243
+ In this case, index will consist from the email value and point that does.
244
+
245
+ 62
246
+ 00:05:16,000 --> 00:05:22,000
247
+ A table associated with this email pointer is, simply speaking, the reference information for the
248
+
249
+ 63
250
+ 00:05:22,000 --> 00:05:26,000
251
+ location of the additional information in memory.
252
+
253
+ 64
254
+ 00:05:26,000 --> 00:05:33,000
255
+ Basically, the index holds is a search term and that particular rows home address on the memory disk
256
+
257
+ 65
258
+ 00:05:34,000 --> 00:05:41,000
259
+ index records comprise such key values and data pointers, multilevel indexes, stores and the disk,
260
+
261
+ 66
262
+ 00:05:41,000 --> 00:05:43,000
263
+ along with the actual database files.
264
+
265
+ 67
266
+ 00:05:44,000 --> 00:05:48,000
267
+ As the size of the database grows, so does the size of the indexes.
268
+
269
+ 68
270
+ 00:05:49,000 --> 00:05:56,000
271
+ There is an immense need to keep the index records in the main memory so as to speed up the search operations.
272
+
273
+ 69
274
+ 00:05:56,000 --> 00:06:03,000
275
+ If single level indexes used in the large size index can not be kept in memory, which leads to multiple
276
+
277
+ 70
278
+ 00:06:03,000 --> 00:06:11,000
279
+ disk accesses, Multilevel Index helps in breaking down the index into several smaller indexes in order
280
+
281
+ 71
282
+ 00:06:11,000 --> 00:06:18,000
283
+ to make the outermost level so small that it can be saved in a single disk block, which can easily
284
+
285
+ 72
286
+ 00:06:18,000 --> 00:06:21,000
287
+ be accommodated anywhere in the main memory.
288
+
289
+ 73
290
+ 00:06:22,000 --> 00:06:25,000
291
+ The index data structure tarp is very likely and B three.
292
+
293
+ 74
294
+ 00:06:26,000 --> 00:06:26,000
295
+ What is it?
296
+
297
+ 75
298
+ 00:06:27,000 --> 00:06:32,000
299
+ In case you are not familiar with this kind of the destruction, I will briefly explain the main points
300
+
301
+ 76
302
+ 00:06:32,000 --> 00:06:32,000
303
+ now.
304
+
305
+ 77
306
+ 00:06:33,000 --> 00:06:35,000
307
+ Well, the advantage of the big three are numerous.
308
+
309
+ 78
310
+ 00:06:36,000 --> 00:06:42,000
311
+ The main advantage for our purposes is that it is searchable when the data structure is sorted in order.
312
+
313
+ 79
314
+ 00:06:42,000 --> 00:06:45,000
315
+ It makes our search more efficient for obvious reasons.
316
+
317
+ 80
318
+ 00:06:46,000 --> 00:06:53,000
319
+ So the definition of victory sounds like this mitre is a self-balancing tree data structure that maintains
320
+
321
+ 81
322
+ 00:06:53,000 --> 00:06:55,000
323
+ source data and allows searches.
324
+
325
+ 82
326
+ 00:06:56,000 --> 00:07:04,000
327
+ Sequential access insertions and deletions in logarithmic time and arbitrary is a balanced binary search
328
+
329
+ 83
330
+ 00:07:04,000 --> 00:07:07,000
331
+ tree that follows a multilevel index format.
332
+
333
+ 84
334
+ 00:07:07,000 --> 00:07:11,000
335
+ The leaf nodes of a tree denote actual data point.
336
+
337
+ 85
338
+ 00:07:11,000 --> 00:07:17,000
339
+ This V3 ensures that all leaf must remain as the same height.
340
+
341
+ 86
342
+ 00:07:17,000 --> 00:07:18,000
343
+ Thus, balance.
344
+
345
+ 87
346
+ 00:07:19,000 --> 00:07:23,000
347
+ Additionally, the leaf nodes are linked using Eliquis.
348
+
349
+ 88
350
+ 00:07:24,000 --> 00:07:29,000
351
+ Therefore, Arbitrary can support random access as well as sequential access.
352
+
353
+ 89
354
+ 00:07:30,000 --> 00:07:35,000
355
+ If you want to run this data structure in details, I have a course where I reviewed different data
356
+
357
+ 90
358
+ 00:07:35,000 --> 00:07:38,000
359
+ structures on examples of containers in Java.
360
+
361
+ 91
362
+ 00:07:39,000 --> 00:07:40,000
363
+ But the general idea is the same.
364
+
365
+ 92
366
+ 00:07:41,000 --> 00:07:44,000
367
+ You can check my Java Collections framework course if you wish.
368
+
369
+ 93
370
+ 00:07:45,000 --> 00:07:49,000
371
+ I also explained in details would be connotation is in that course.
372
+
373
+ 94
374
+ 00:07:50,000 --> 00:07:53,000
375
+ Now let's proceed with learning of indexes.
376
+
377
+ 95
378
+ 00:07:54,000 --> 00:07:58,000
379
+ I'm going to explain in now different types of indexes the three types of Zen.
380
+
381
+ 96
382
+ 00:07:59,000 --> 00:08:07,000
383
+ They are primary secondary clustering, primary index and turn maybe dance or sparse.
384
+
385
+ 97
386
+ 00:08:07,000 --> 00:08:14,000
387
+ Primary index refers to an index stored in sorted order on the certain key of data storage and blocks
388
+
389
+ 98
390
+ 00:08:15,000 --> 00:08:16,000
391
+ to look up a value.
392
+
393
+ 99
394
+ 00:08:17,000 --> 00:08:23,000
395
+ You do a binary search on the index, which will produce a pointer to the blog, and then you can do
396
+
397
+ 100
398
+ 00:08:23,000 --> 00:08:26,000
399
+ a binary search on the data in the block.
400
+
401
+ 101
402
+ 00:08:26,000 --> 00:08:28,000
403
+ Let's start from the primary index.
404
+
405
+ 102
406
+ 00:08:29,000 --> 00:08:35,000
407
+ Primary indexes and orders file, which is fixed length size, which still feels and like we have previously
408
+
409
+ 103
410
+ 00:08:35,000 --> 00:08:36,000
411
+ discussed.
412
+
413
+ 104
414
+ 00:08:36,000 --> 00:08:43,000
415
+ The first field is the same as index value, and second is a pointer to that specific data block.
416
+
417
+ 105
418
+ 00:08:43,000 --> 00:08:50,000
419
+ We can say that there is always one to one relationship between the entries in the index table you already
420
+
421
+ 106
422
+ 00:08:50,000 --> 00:08:52,000
423
+ know from previous slide.
424
+
425
+ 107
426
+ 00:08:52,000 --> 00:09:00,000
427
+ The primary index member is a dense or sparse and dense indexing database is an index was pairs of keys
428
+
429
+ 108
430
+ 00:09:00,000 --> 00:09:02,000
431
+ and pointers for every records.
432
+
433
+ 109
434
+ 00:09:02,000 --> 00:09:08,000
435
+ Every key in this file is associated with a particular point that the record in the source of data file.
436
+
437
+ 110
438
+ 00:09:09,000 --> 00:09:15,000
439
+ This means that the number of records in the index table is the same as the number of records in the
440
+
441
+ 111
442
+ 00:09:15,000 --> 00:09:16,000
443
+ main table.
444
+
445
+ 112
446
+ 00:09:17,000 --> 00:09:24,000
447
+ Obviously, this type of index needs more space to store index records itself in comparison with sparse
448
+
449
+ 113
450
+ 00:09:24,000 --> 00:09:25,000
451
+ primary index.
452
+
453
+ 114
454
+ 00:09:26,000 --> 00:09:29,000
455
+ The Spurs primary index is somewhat different.
456
+
457
+ 115
458
+ 00:09:29,000 --> 00:09:34,000
459
+ It is an index record that appears for only some of the values in the file.
460
+
461
+ 116
462
+ 00:09:35,000 --> 00:09:41,000
463
+ Sparse Index helps you to resolve the issues of dense index and database management system.
464
+
465
+ 117
466
+ 00:09:42,000 --> 00:09:49,000
467
+ Following this indexing technique, a range of index columns stores the same data block address, and
468
+
469
+ 118
470
+ 00:09:49,000 --> 00:09:53,000
471
+ when data needs to be retrieved, the block address will be fetched.
472
+
473
+ 119
474
+ 00:09:54,000 --> 00:09:57,000
475
+ This is key difference between dance and sports in this.
476
+
477
+ 120
478
+ 00:09:58,000 --> 00:10:03,000
479
+ Let me repeat one more time, in other words, and pay attention to the visualisation of the slide.
480
+
481
+ 121
482
+ 00:10:03,000 --> 00:10:07,000
483
+ To understand this better, we have blocks that source.
484
+
485
+ 122
486
+ 00:10:07,000 --> 00:10:15,000
487
+ A range of data is a clear and based on the search query, I get access to the block of data.
488
+
489
+ 123
490
+ 00:10:16,000 --> 00:10:20,000
491
+ After that, we'll go over the data and look linearly till we get the requested data.
492
+
493
+ 124
494
+ 00:10:21,000 --> 00:10:28,000
495
+ Also, in comparison to dancing, surpassing the source index records for only some search key values.
496
+
497
+ 125
498
+ 00:10:28,000 --> 00:10:35,000
499
+ Thus, its advantage in requiring less space, less maintenance overhead for insertion and deletions.
500
+
501
+ 126
502
+ 00:10:36,000 --> 00:10:40,000
503
+ So as you already understood, sparse index is called.
504
+
505
+ 127
506
+ 00:10:40,000 --> 00:10:47,000
507
+ So because we need less number of pointers from index, the records of database all records are arranged
508
+
509
+ 128
510
+ 00:10:47,000 --> 00:10:55,000
511
+ based on order is key, and hence we can quickly access the record by going to block first and then
512
+
513
+ 129
514
+ 00:10:55,000 --> 00:11:00,000
515
+ access the following records without having individual index for each of the records.
516
+
517
+ 130
518
+ 00:11:00,000 --> 00:11:01,000
519
+ Does it make sense?
520
+
521
+ 131
522
+ 00:11:02,000 --> 00:11:08,000
523
+ We are done with primary in this, even in case you have any questions related to primary index.
524
+
525
+ 132
526
+ 00:11:08,000 --> 00:11:15,000
527
+ Please do not hesitate to ask your questions in the comments to this video, and I will be happy to
528
+
529
+ 133
530
+ 00:11:15,000 --> 00:11:15,000
531
+ answer.
532
+
533
+ 134
534
+ 00:11:16,000 --> 00:11:18,000
535
+ Let's move on now.
536
+
537
+ 135
538
+ 00:11:18,000 --> 00:11:20,000
539
+ Let's discuss and learn what secondary indexes.
540
+
541
+ 136
542
+ 00:11:21,000 --> 00:11:28,000
543
+ In the index in database management system can be generated by a field which has a unique value for
544
+
545
+ 137
546
+ 00:11:28,000 --> 00:11:31,000
547
+ each record, and it should be a candidate key.
548
+
549
+ 138
550
+ 00:11:32,000 --> 00:11:38,000
551
+ If you don't remember what candidate K is this similar turn to alternate key?
552
+
553
+ 139
554
+ 00:11:38,000 --> 00:11:43,000
555
+ Please review one more time lesson about basic terms in a relational databases.
556
+
557
+ 140
558
+ 00:11:44,000 --> 00:11:51,000
559
+ Imagine that you have a table of users, and most likely you're going to have a column that will be
560
+
561
+ 141
562
+ 00:11:51,000 --> 00:11:55,000
563
+ used as primary key and primary index for records in this table.
564
+
565
+ 142
566
+ 00:11:56,000 --> 00:12:02,000
567
+ But you know that according to your business, logic user may be often requested by email.
568
+
569
+ 143
570
+ 00:12:03,000 --> 00:12:06,000
571
+ That's why you decide to create one more index for email.
572
+
573
+ 144
574
+ 00:12:07,000 --> 00:12:13,000
575
+ Email column contains also unique values and may be treated as candidate key.
576
+
577
+ 145
578
+ 00:12:13,000 --> 00:12:14,000
579
+ Does it make sense?
580
+
581
+ 146
582
+ 00:12:15,000 --> 00:12:16,000
583
+ Let me explain now.
584
+
585
+ 147
586
+ 00:12:16,000 --> 00:12:24,000
587
+ Cluster Index If you all understood what's primary and secondary indexes are, it will be easier for
588
+
589
+ 148
590
+ 00:12:24,000 --> 00:12:26,000
591
+ you to understand clustering index.
592
+
593
+ 149
594
+ 00:12:27,000 --> 00:12:33,000
595
+ Imagine that you want to improve performance of reading the records, querying them by column that may
596
+
597
+ 150
598
+ 00:12:33,000 --> 00:12:35,000
599
+ contain similar values and multiple rows.
600
+
601
+ 151
602
+ 00:12:36,000 --> 00:12:42,000
603
+ For example, in the same scenario with users, in case you want to search user by their last name,
604
+
605
+ 152
606
+ 00:12:43,000 --> 00:12:47,000
607
+ you should understand is it last name may not always be unique.
608
+
609
+ 153
610
+ 00:12:48,000 --> 00:12:56,000
611
+ Z.Z Use Case of Clustering Index In order to identify the records first, it will look two or more columns
612
+
613
+ 154
614
+ 00:12:56,000 --> 00:13:00,000
615
+ together to get the values and create index out of them.
616
+
617
+ 155
618
+ 00:13:00,000 --> 00:13:06,000
619
+ Pay attention to this because it is critically important to have unique search query, and this is impossible
620
+
621
+ 156
622
+ 00:13:06,000 --> 00:13:09,000
623
+ to create index on non unique values.
624
+
625
+ 157
626
+ 00:13:10,000 --> 00:13:16,000
627
+ So you still would need to identify a combination of columns that will give you Zanik value for each
628
+
629
+ 158
630
+ 00:13:16,000 --> 00:13:19,000
631
+ step and create index based on that.
632
+
633
+ 159
634
+ 00:13:19,000 --> 00:13:26,000
635
+ This method is called a clustering index, basically records with similar characteristics and grouped
636
+
637
+ 160
638
+ 00:13:26,000 --> 00:13:29,000
639
+ together, and indexes are created for these groups.
640
+
641
+ 161
642
+ 00:13:30,000 --> 00:13:34,000
643
+ I believe they learned enough theory to jump the practice activities.
644
+
645
+ 162
646
+ 00:13:35,000 --> 00:13:39,000
647
+ We're going to use our user tables that we created in previous lessons.
648
+
649
+ 163
650
+ 00:13:39,000 --> 00:13:42,000
651
+ In case you don't know how to create a table.
652
+
653
+ 164
654
+ 00:13:42,000 --> 00:13:43,000
655
+ Want to create a similar one?
656
+
657
+ 165
658
+ 00:13:44,000 --> 00:13:46,000
659
+ Please make sure you watch the previous lesson.
660
+
661
+ 166
662
+ 00:13:47,000 --> 00:13:53,000
663
+ When we created our first table and database do mouse, right click over the table and select Alter
664
+
665
+ 167
666
+ 00:13:53,000 --> 00:13:57,000
667
+ Table Select Indexes set up here.
668
+
669
+ 168
670
+ 00:13:58,000 --> 00:14:03,000
671
+ This is a tab that allows us to create, configure and remove indexes.
672
+
673
+ 169
674
+ 00:14:04,000 --> 00:14:11,000
675
+ Each index has name to create new index, click in an empty row and time and a name.
676
+
677
+ 170
678
+ 00:14:11,000 --> 00:14:13,000
679
+ After that, select in the start.
680
+
681
+ 171
682
+ 00:14:14,000 --> 00:14:16,000
683
+ Let me review Is you each of this?
684
+
685
+ 172
686
+ 00:14:17,000 --> 00:14:18,000
687
+ This is my SQL index types.
688
+
689
+ 173
690
+ 00:14:19,000 --> 00:14:26,000
691
+ They're similar from the relational database theory that we have discussed, but definitely this ones
692
+
693
+ 174
694
+ 00:14:26,000 --> 00:14:29,000
695
+ have specifics related to my school database management system.
696
+
697
+ 175
698
+ 00:14:29,000 --> 00:14:37,000
699
+ Only primary index is created by default for each primary key, and you see the one was already created.
700
+
701
+ 176
702
+ 00:14:38,000 --> 00:14:42,000
703
+ My school creates the index by default for primary key column.
704
+
705
+ 177
706
+ 00:14:43,000 --> 00:14:46,000
707
+ You can click on existing index to explore the details.
708
+
709
+ 178
710
+ 00:14:47,000 --> 00:14:55,000
711
+ For example, you can learn which column is used to create this index and column, or I send them all
712
+
713
+ 179
714
+ 00:14:55,000 --> 00:14:55,000
715
+ this send.
716
+
717
+ 180
718
+ 00:14:56,000 --> 00:15:04,000
719
+ In this time may be used for secondary indexes, that means that values in this column may not be unique.
720
+
721
+ 181
722
+ 00:15:05,000 --> 00:15:10,000
723
+ For example, you can see that my school automatically created index for foreign key.
724
+
725
+ 182
726
+ 00:15:11,000 --> 00:15:12,000
727
+ I didn't do that.
728
+
729
+ 183
730
+ 00:15:12,000 --> 00:15:14,000
731
+ This was done by my school.
732
+
733
+ 184
734
+ 00:15:15,000 --> 00:15:19,000
735
+ Unique index type created four columns was only unique values.
736
+
737
+ 185
738
+ 00:15:20,000 --> 00:15:24,000
739
+ For example, you may have unique properties set for email column.
740
+
741
+ 186
742
+ 00:15:24,000 --> 00:15:28,000
743
+ That means that it is possible to create unique index for this column.
744
+
745
+ 187
746
+ 00:15:28,000 --> 00:15:32,000
747
+ To discuss reading operations from user table.
748
+
749
+ 188
750
+ 00:15:32,000 --> 00:15:36,000
751
+ Using user email in search query will become faster.
752
+
753
+ 189
754
+ 00:15:36,000 --> 00:15:44,000
755
+ Full text indexes are used for full text searches on in the BE and might use some storage engines,
756
+
757
+ 190
758
+ 00:15:44,000 --> 00:15:50,000
759
+ support full text indexes and only for Char Bircher and text columns.
760
+
761
+ 191
762
+ 00:15:51,000 --> 00:15:56,000
763
+ Indexing always takes place over the entire column and column preface.
764
+
765
+ 192
766
+ 00:15:57,000 --> 00:16:01,000
767
+ Also, we can create indexes on spatial data types.
768
+
769
+ 193
770
+ 00:16:01,000 --> 00:16:10,000
771
+ My Esam and in B supports our three indexes on special types as a search engines use matrix for index
772
+
773
+ 194
774
+ 00:16:10,000 --> 00:16:17,000
775
+ and special types, except for archive, which doesn't support special type indexing.
776
+
777
+ 195
778
+ 00:16:19,000 --> 00:16:25,000
779
+ On this slide, you can see the characteristics of different index types in energy B storage engine
780
+
781
+ 196
782
+ 00:16:25,000 --> 00:16:26,000
783
+ of my school.
784
+
785
+ 197
786
+ 00:16:27,000 --> 00:16:31,000
787
+ Each index also has a different set of properties.
788
+
789
+ 198
790
+ 00:16:31,000 --> 00:16:38,000
791
+ Let's review each of them for string columns, indexes may use only as a leading part of column values
792
+
793
+ 199
794
+ 00:16:39,000 --> 00:16:40,000
795
+ using blanks property.
796
+
797
+ 200
798
+ 00:16:41,000 --> 00:16:47,000
799
+ This allows us to create index only for prefixes and other properties that can be used.
800
+
801
+ 201
802
+ 00:16:47,000 --> 00:16:55,000
803
+ Here is a key block source for my use some tables Key block size optionally specifies the size in bytes
804
+
805
+ 202
806
+ 00:16:55,000 --> 00:16:57,000
807
+ to use for index key blocks.
808
+
809
+ 203
810
+ 00:16:58,000 --> 00:17:03,000
811
+ The value is treated as a hint and different size could be used if necessary.
812
+
813
+ 204
814
+ 00:17:04,000 --> 00:17:10,000
815
+ Akeem Look Source value specified for an individual index definition overrides a table level key block
816
+
817
+ 205
818
+ 00:17:10,000 --> 00:17:11,000
819
+ size value.
820
+
821
+ 206
822
+ 00:17:12,000 --> 00:17:15,000
823
+ It is not supported at the index level for any DB tables.
824
+
825
+ 207
826
+ 00:17:16,000 --> 00:17:21,000
827
+ Also only for full text indexes, you can specify parser.
828
+
829
+ 208
830
+ 00:17:22,000 --> 00:17:29,000
831
+ It associates a person plug in with the index if full text indexing and search and operations need special
832
+
833
+ 209
834
+ 00:17:29,000 --> 00:17:34,000
835
+ handling in London, B and My s some supports full text parser plugins.
836
+
837
+ 210
838
+ 00:17:34,000 --> 00:17:40,000
839
+ If you are interested, you can find more information in official documentation of my SQL about full
840
+
841
+ 211
842
+ 00:17:40,000 --> 00:17:47,000
843
+ text parser plugins for this specific case, I believe that topic lies outside of the scope of this
844
+
845
+ 212
846
+ 00:17:47,000 --> 00:17:48,000
847
+ lesson.
848
+
849
+ 213
850
+ 00:17:48,000 --> 00:17:51,000
851
+ Also, you can specify index visibility.
852
+
853
+ 214
854
+ 00:17:51,000 --> 00:17:53,000
855
+ You have separate checkbox here.
856
+
857
+ 215
858
+ 00:17:54,000 --> 00:18:01,000
859
+ You can place a tweak to make index visible and you can remove it take to make index invisible.
860
+
861
+ 216
862
+ 00:18:01,000 --> 00:18:04,000
863
+ My cycle supports invisible indexes.
864
+
865
+ 217
866
+ 00:18:04,000 --> 00:18:08,000
867
+ That is, indexes that are not used by the optimizer.
868
+
869
+ 218
870
+ 00:18:09,000 --> 00:18:13,000
871
+ The feature applies to indexes, pauses and primary keys.
872
+
873
+ 219
874
+ 00:18:13,000 --> 00:18:18,000
875
+ Using explicit or implicit indexes are visible by default.
876
+
877
+ 220
878
+ 00:18:19,000 --> 00:18:27,000
879
+ After you configure it all what you need, just click apply button and execute generated SQL query to
880
+
881
+ 221
882
+ 00:18:27,000 --> 00:18:32,000
883
+ remove indexes that you created, do most right click on the index and click Delete selected.
884
+
885
+ 222
886
+ 00:18:33,000 --> 00:18:33,000
887
+ That's it.
888
+
889
+ 223
890
+ 00:18:34,000 --> 00:18:40,000
891
+ By this moment in our lesson, I believe you already have both theoretical and practical understanding
892
+
893
+ 224
894
+ 00:18:40,000 --> 00:18:41,000
895
+ of indexes.
896
+
897
+ 225
898
+ 00:18:42,000 --> 00:18:47,000
899
+ And now we will be able to come up with advantages and disadvantages of indexes.
900
+
901
+ 226
902
+ 00:18:47,000 --> 00:18:48,000
903
+ Together with me.
904
+
905
+ 227
906
+ 00:18:49,000 --> 00:18:55,000
907
+ And one advantage advantages of indexing it is worth to mention the following once it helps to reduce
908
+
909
+ 228
910
+ 00:18:55,000 --> 00:19:02,000
911
+ the total number of input output operations needed to retrieve that data offers faster search and retrieval
912
+
913
+ 229
914
+ 00:19:02,000 --> 00:19:03,000
915
+ of data.
916
+
917
+ 230
918
+ 00:19:04,000 --> 00:19:10,000
919
+ So we can say that performance of raid operations is increased and we shouldn't forget about the next
920
+
921
+ 231
922
+ 00:19:10,000 --> 00:19:19,000
923
+ disadvantages additional disk memory space needed to store index decreased performance of write operations,
924
+
925
+ 232
926
+ 00:19:19,000 --> 00:19:27,000
927
+ slower insert, update and delete operations because besides removal of trouble, it is also required
928
+
929
+ 233
930
+ 00:19:27,000 --> 00:19:30,000
931
+ to recalculate index to keep it in sorted state.
932
+
933
+ 234
934
+ 00:19:31,000 --> 00:19:34,000
935
+ That's all what I wanted to discuss with you today in this lesson.
936
+
937
+ 235
938
+ 00:19:34,000 --> 00:19:36,000
939
+ Let's recap what we have learned today.
940
+
941
+ 236
942
+ 00:19:37,000 --> 00:19:41,000
943
+ In this lesson, we have learned a lot of interesting things about indexes.
944
+
945
+ 237
946
+ 00:19:42,000 --> 00:19:44,000
947
+ They learned what indexing database is.
948
+
949
+ 238
950
+ 00:19:45,000 --> 00:19:48,000
951
+ I believe that you understood why we need indexes.
952
+
953
+ 239
954
+ 00:19:49,000 --> 00:19:54,000
955
+ Also, I put separate focus on the details to help you understand how it works.
956
+
957
+ 240
958
+ 00:19:55,000 --> 00:20:03,000
959
+ You also know what be tree data structure is and how logarithmic connotation of elements retrieval from
960
+
961
+ 241
962
+ 00:20:03,000 --> 00:20:07,000
963
+ collection may be achieved via a view of different index types.
964
+
965
+ 242
966
+ 00:20:08,000 --> 00:20:11,000
967
+ Those include primary secondary clustering.
968
+
969
+ 243
970
+ 00:20:11,000 --> 00:20:18,000
971
+ I showed you how to create and remove indexes in database, and at the end of the lesson, we have reviewed
972
+
973
+ 244
974
+ 00:20:18,000 --> 00:20:21,000
975
+ advantages and disadvantages of using indexes.
976
+
977
+ 245
978
+ 00:20:22,000 --> 00:20:23,000
979
+ That's all for this lesson.
980
+
981
+ 246
982
+ 00:20:24,000 --> 00:20:26,000
983
+ Thanks a lot for your attention, Tim.
984
+
985
+ 247
986
+ 00:20:26,000 --> 00:20:29,000
987
+ Have a great day and see you in the next lesson.
988
+
47 - Relational databases/005 Database Normalization & Denormalization_en.srt ADDED
@@ -0,0 +1,1576 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:06,000 --> 00:00:11,000
3
+ Hello, yes, tenants in this lesson, we're going to learn more advanced concepts in the relational
4
+
5
+ 2
6
+ 00:00:11,000 --> 00:00:12,000
7
+ databases.
8
+
9
+ 3
10
+ 00:00:12,000 --> 00:00:17,000
11
+ We're going to talk about database normalization and normalization.
12
+
13
+ 4
14
+ 00:00:17,000 --> 00:00:20,000
15
+ Believe me, this is a really important lesson.
16
+
17
+ 5
18
+ 00:00:20,000 --> 00:00:26,000
19
+ And knowing the rules that I'm going to share with you in this lesson, you will be able to create scalable
20
+
21
+ 6
22
+ 00:00:26,000 --> 00:00:28,000
23
+ database architecture.
24
+
25
+ 7
26
+ 00:00:28,000 --> 00:00:31,000
27
+ And also, this will help you a lot in your career.
28
+
29
+ 8
30
+ 00:00:32,000 --> 00:00:37,000
31
+ We are going to study the lesson from understanding of what data anomalies are.
32
+
33
+ 9
34
+ 00:00:38,000 --> 00:00:44,000
35
+ I'm going to explain what insertion date and deletion anomaly is known as a problem.
36
+
37
+ 10
38
+ 00:00:44,000 --> 00:00:46,000
39
+ We'll learn how to avoid it.
40
+
41
+ 11
42
+ 00:00:46,000 --> 00:00:53,000
43
+ And after understanding of basics of dependency theory, we'll jump to our main topic today.
44
+
45
+ 12
46
+ 00:00:53,000 --> 00:00:59,000
47
+ I'm talking about normalization and normal forms that we are going to review with examples.
48
+
49
+ 13
50
+ 00:00:59,000 --> 00:01:03,000
51
+ Anthem's and obsolescent will discuss what the normalization is.
52
+
53
+ 14
54
+ 00:01:04,000 --> 00:01:05,000
55
+ Let's start our lesson.
56
+
57
+ 15
58
+ 00:01:06,000 --> 00:01:12,000
59
+ And before we even jump to discussion of what normalization is, let's understand what problem we have
60
+
61
+ 16
62
+ 00:01:12,000 --> 00:01:13,000
63
+ learned to address.
64
+
65
+ 17
66
+ 00:01:13,000 --> 00:01:16,000
67
+ Let me explain you what data anomalies are.
68
+
69
+ 18
70
+ 00:01:17,000 --> 00:01:24,000
71
+ Data anomalies are inconsistencies in the data stored in the database as a result of an operation such
72
+
73
+ 19
74
+ 00:01:24,000 --> 00:01:27,000
75
+ as update insertion and or deletion.
76
+
77
+ 20
78
+ 00:01:28,000 --> 00:01:34,000
79
+ Such inconsistencies may arise when we have a particular records stored in multiple locations, and
80
+
81
+ 21
82
+ 00:01:34,000 --> 00:01:42,000
83
+ not all of the corpus are updated generally and with relational database design must capture all of
84
+
85
+ 22
86
+ 00:01:42,000 --> 00:01:45,000
87
+ the necessary attributes and associations.
88
+
89
+ 23
90
+ 00:01:46,000 --> 00:01:53,000
91
+ The design should do this was a minimal amount of storage information and no redundant data in database
92
+
93
+ 24
94
+ 00:01:53,000 --> 00:01:54,000
95
+ design.
96
+
97
+ 25
98
+ 00:01:54,000 --> 00:02:01,000
99
+ Redundancy is generally undesirable because it causes problems maintaining consistency after updates.
100
+
101
+ 26
102
+ 00:02:02,000 --> 00:02:08,000
103
+ We are going to learn such term as normalization later today, but I already can say that normalization
104
+
105
+ 27
106
+ 00:02:08,000 --> 00:02:14,000
107
+ can help us to reduce data redundancy and minimize risks of data anomalies.
108
+
109
+ 28
110
+ 00:02:14,000 --> 00:02:18,000
111
+ But sometimes we want to add data redundancy on purpose.
112
+
113
+ 29
114
+ 00:02:19,000 --> 00:02:26,000
115
+ We need to do this carefully and was clear understanding of why we are doing this and what benefits
116
+
117
+ 30
118
+ 00:02:26,000 --> 00:02:27,000
119
+ we expect to get.
120
+
121
+ 31
122
+ 00:02:28,000 --> 00:02:31,000
123
+ Redundancy can sometimes leave the performance improvements.
124
+
125
+ 32
126
+ 00:02:32,000 --> 00:02:36,000
127
+ We are going to discuss how this may improve our performance.
128
+
129
+ 33
130
+ 00:02:36,000 --> 00:02:41,000
131
+ One will talk about the normalization Xen different, anomalous.
132
+
133
+ 34
134
+ 00:02:41,000 --> 00:02:42,000
135
+ Let's review some of them.
136
+
137
+ 35
138
+ 00:02:43,000 --> 00:02:47,000
139
+ I'm going to show different types of anomalies on example.
140
+
141
+ 36
142
+ 00:02:47,000 --> 00:02:49,000
143
+ Let's look at this example first.
144
+
145
+ 37
146
+ 00:02:50,000 --> 00:02:53,000
147
+ Imagine that we have a table with suppliers.
148
+
149
+ 38
150
+ 00:02:53,000 --> 00:02:59,000
151
+ We also store information about them like address and products they produce.
152
+
153
+ 39
154
+ 00:02:59,000 --> 00:03:04,000
155
+ There is also information about quantity of each product and its price.
156
+
157
+ 40
158
+ 00:03:04,000 --> 00:03:05,000
159
+ Is that clear?
160
+
161
+ 41
162
+ 00:03:06,000 --> 00:03:08,000
163
+ What do you think about this table?
164
+
165
+ 42
166
+ 00:03:08,000 --> 00:03:10,000
167
+ Is it looks good to you.
168
+
169
+ 43
170
+ 00:03:11,000 --> 00:03:17,000
171
+ Well, we're going to review in detail what is wrong in such kind of tables.
172
+
173
+ 44
174
+ 00:03:17,000 --> 00:03:20,000
175
+ You already see huge data redundancy in this table.
176
+
177
+ 45
178
+ 00:03:21,000 --> 00:03:27,000
179
+ Also, I believe we can notice is that the relationships between a key attribute and other data you
180
+
181
+ 46
182
+ 00:03:27,000 --> 00:03:29,000
183
+ topple is not always logical.
184
+
185
+ 47
186
+ 00:03:30,000 --> 00:03:34,000
187
+ Let me show you in detail what problems may be caused by this data redundancy.
188
+
189
+ 48
190
+ 00:03:35,000 --> 00:03:42,000
191
+ And the first anomalies that we are going to learn is insertion anomaly imagines that we need that new
192
+
193
+ 49
194
+ 00:03:42,000 --> 00:03:42,000
195
+ supplier.
196
+
197
+ 50
198
+ 00:03:43,000 --> 00:03:45,000
199
+ We know its name.
200
+
201
+ 51
202
+ 00:03:45,000 --> 00:03:49,000
203
+ We know it's address, but we don't know.
204
+
205
+ 52
206
+ 00:03:49,000 --> 00:03:51,000
207
+ These are products that it produces.
208
+
209
+ 53
210
+ 00:03:51,000 --> 00:03:53,000
211
+ No prices for these brothers.
212
+
213
+ 54
214
+ 00:03:53,000 --> 00:03:56,000
215
+ We just started cooperation with them.
216
+
217
+ 55
218
+ 00:03:56,000 --> 00:03:58,000
219
+ A company has been just registered.
220
+
221
+ 56
222
+ 00:03:59,000 --> 00:04:03,000
223
+ And what should I put in product quantity and price columns?
224
+
225
+ 57
226
+ 00:04:03,000 --> 00:04:06,000
227
+ I have to put empty, of course, data.
228
+
229
+ 58
230
+ 00:04:06,000 --> 00:04:09,000
231
+ In this case, I have to base is a No.
232
+
233
+ 59
234
+ 00:04:10,000 --> 00:04:12,000
235
+ Zero in different columns.
236
+
237
+ 60
238
+ 00:04:12,000 --> 00:04:13,000
239
+ But is this correct?
240
+
241
+ 61
242
+ 00:04:14,000 --> 00:04:21,000
243
+ Why I obligated to come up with values for columns that I don't need to use in this moment?
244
+
245
+ 62
246
+ 00:04:21,000 --> 00:04:29,000
247
+ What if I just not aware about their products or why after companies established that was information
248
+
249
+ 63
250
+ 00:04:29,000 --> 00:04:30,000
251
+ about their products?
252
+
253
+ 64
254
+ 00:04:30,000 --> 00:04:35,000
255
+ If I just could add new rows was a product a lot of questions.
256
+
257
+ 65
258
+ 00:04:36,000 --> 00:04:42,000
259
+ Another type of anomaly is update anomaly imagines that we decided to update supplier name.
260
+
261
+ 66
262
+ 00:04:43,000 --> 00:04:48,000
263
+ Probably because of company reorganization, they decided to change their public name.
264
+
265
+ 67
266
+ 00:04:49,000 --> 00:04:56,000
267
+ And now we need to execute the query to update all tables where we used suppliers name.
268
+
269
+ 68
270
+ 00:04:56,000 --> 00:05:01,000
271
+ And we have really a lot of records where we need to accommodate supplier snake.
272
+
273
+ 69
274
+ 00:05:02,000 --> 00:05:10,000
275
+ But what if we accidentally forgot it for some records during insertion, we added out, and for some
276
+
277
+ 70
278
+ 00:05:10,000 --> 00:05:10,000
279
+ not.
280
+
281
+ 71
282
+ 00:05:11,000 --> 00:05:18,000
283
+ What if accidentally SSEG different amount of space characters and some records still will be not updated?
284
+
285
+ 72
286
+ 00:05:18,000 --> 00:05:26,000
287
+ In this case, I'm going to face that anomaly because after object, I will have inconsistent and not
288
+
289
+ 73
290
+ 00:05:26,000 --> 00:05:27,000
291
+ valid data.
292
+
293
+ 74
294
+ 00:05:28,000 --> 00:05:30,000
295
+ Do not accidentally forget the date throws.
296
+
297
+ 75
298
+ 00:05:30,000 --> 00:05:38,000
299
+ It would be better if we could organize the restructure in a way when we have only one place where we
300
+
301
+ 76
302
+ 00:05:38,000 --> 00:05:43,000
303
+ store supplier's name, then the risk of facing an added anomaly is minimal.
304
+
305
+ 77
306
+ 00:05:44,000 --> 00:05:46,000
307
+ Let's have the deletion anomaly now.
308
+
309
+ 78
310
+ 00:05:47,000 --> 00:05:54,000
311
+ This type of anomaly may occur when we remove information and together with it, or remove information
312
+
313
+ 79
314
+ 00:05:54,000 --> 00:05:55,000
315
+ that shouldn't be removed.
316
+
317
+ 80
318
+ 00:05:56,000 --> 00:06:04,000
319
+ For example, we stopped cooperation with one supplier or we need just to remove information about delivery.
320
+
321
+ 81
322
+ 00:06:04,000 --> 00:06:11,000
323
+ And in case we remove information about delivery, we lose information about our supplier and vice versa.
324
+
325
+ 82
326
+ 00:06:12,000 --> 00:06:15,000
327
+ All this information is important for our accounting department.
328
+
329
+ 83
330
+ 00:06:16,000 --> 00:06:20,000
331
+ We also might need to use this information to create different reports.
332
+
333
+ 84
334
+ 00:06:21,000 --> 00:06:25,000
335
+ What we should do in this case, it is hard question to answer.
336
+
337
+ 85
338
+ 00:06:26,000 --> 00:06:30,000
339
+ Do you see what problems may be caused by data redundancy in our table?
340
+
341
+ 86
342
+ 00:06:30,000 --> 00:06:32,000
343
+ How to fix this.
344
+
345
+ 87
346
+ 00:06:32,000 --> 00:06:39,000
347
+ The best approach to create tables without anomalies is to ensure that the tables are normalized, and
348
+
349
+ 88
350
+ 00:06:39,000 --> 00:06:43,000
351
+ that's accomplished by understanding functional dependencies.
352
+
353
+ 89
354
+ 00:06:43,000 --> 00:06:49,000
355
+ Functional dependency ensures that all attributes in the table belong to that table.
356
+
357
+ 90
358
+ 00:06:50,000 --> 00:06:54,000
359
+ In other words, it will eliminate redundancies and anomalies.
360
+
361
+ 91
362
+ 00:06:55,000 --> 00:07:02,000
363
+ Let me show you as a solution for our example and what structure would help us to avoid the two anomalies.
364
+
365
+ 92
366
+ 00:07:02,000 --> 00:07:07,000
367
+ Let's change our tables and create two tables instead of one.
368
+
369
+ 93
370
+ 00:07:08,000 --> 00:07:12,000
371
+ We create supply a table and also a great delivery table.
372
+
373
+ 94
374
+ 00:07:13,000 --> 00:07:17,000
375
+ In one table, we can store all information related to supply.
376
+
377
+ 95
378
+ 00:07:17,000 --> 00:07:23,000
379
+ And in another table, we're going to store all information related to delivery.
380
+
381
+ 96
382
+ 00:07:23,000 --> 00:07:26,000
383
+ And we establish relationships between these two tables.
384
+
385
+ 97
386
+ 00:07:27,000 --> 00:07:31,000
387
+ So avoid data duplication, for example, for each delivery.
388
+
389
+ 98
390
+ 00:07:31,000 --> 00:07:33,000
391
+ There is a specific supply.
392
+
393
+ 99
394
+ 00:07:33,000 --> 00:07:36,000
395
+ Each supplier can have many deliveries.
396
+
397
+ 100
398
+ 00:07:37,000 --> 00:07:39,000
399
+ Each delivery is provided by one supplier.
400
+
401
+ 101
402
+ 00:07:40,000 --> 00:07:45,000
403
+ Is it clear we want to add information about is delivery or supply?
404
+
405
+ 102
406
+ 00:07:46,000 --> 00:07:52,000
407
+ We are not obligated to add false information or information that we don't have in this moment.
408
+
409
+ 103
410
+ 00:07:53,000 --> 00:07:56,000
411
+ No dummy values are needed during the insertion.
412
+
413
+ 104
414
+ 00:07:56,000 --> 00:08:04,000
415
+ This resource, our insertion anomaly in the case, we want to add the name of supplier or its address.
416
+
417
+ 105
418
+ 00:08:04,000 --> 00:08:07,000
419
+ We shouldn't do this in hundredths rose.
420
+
421
+ 106
422
+ 00:08:07,000 --> 00:08:14,000
423
+ We do this in one place and the reference to the supply is still the same in delivery table in case
424
+
425
+ 107
426
+ 00:08:14,000 --> 00:08:19,000
427
+ we want to remove information about delivery but don't want to remove information about supply.
428
+
429
+ 108
430
+ 00:08:20,000 --> 00:08:27,000
431
+ We just do so we can do that both from delivery table without losing data from supply table.
432
+
433
+ 109
434
+ 00:08:27,000 --> 00:08:28,000
435
+ Isn't this cool?
436
+
437
+ 110
438
+ 00:08:29,000 --> 00:08:35,000
439
+ That's why, though, would this anomalous, you need to know what normalization is and its main rules.
440
+
441
+ 111
442
+ 00:08:36,000 --> 00:08:42,000
443
+ But before starting to learn normal forms and normalization, we need to learn a little bit more theory
444
+
445
+ 112
446
+ 00:08:43,000 --> 00:08:49,000
447
+ because you need to know at least some key concepts from dependencies theory in order you could understand
448
+
449
+ 113
450
+ 00:08:49,000 --> 00:08:57,000
451
+ normalization dependency theory is a sub field of database theory, which status, implication and optimization
452
+
453
+ 114
454
+ 00:08:57,000 --> 00:09:02,000
455
+ problems related to logical constraints, commonly called dependencies.
456
+
457
+ 115
458
+ 00:09:02,000 --> 00:09:10,000
459
+ On that basis, the best known class of such dependencies are functional dependencies, which forms
460
+
461
+ 116
462
+ 00:09:10,000 --> 00:09:13,000
463
+ the foundation of keys on database relations.
464
+
465
+ 117
466
+ 00:09:13,000 --> 00:09:18,000
467
+ And in this lesson, we are going to review excerpts from dependency theory.
468
+
469
+ 118
470
+ 00:09:18,000 --> 00:09:19,000
471
+ Let's start.
472
+
473
+ 119
474
+ 00:09:20,000 --> 00:09:26,000
475
+ And as a result, you said one of the main concept in the theory is functional dependency.
476
+
477
+ 120
478
+ 00:09:27,000 --> 00:09:34,000
479
+ Financial dependency tells us that if we have two attributes X and Y of some relationship, then wise
480
+
481
+ 121
482
+ 00:09:34,000 --> 00:09:45,000
483
+ functional dependence on X if in any moment of time each X value matches, only one y value X is set
484
+
485
+ 122
486
+ 00:09:45,000 --> 00:09:47,000
487
+ to functionally determine Y.
488
+
489
+ 123
490
+ 00:09:48,000 --> 00:09:54,000
491
+ Functional dependency is a constraint between two sets of attributes in the relation from a database,
492
+
493
+ 124
494
+ 00:09:55,000 --> 00:10:03,000
495
+ for example, bus number and last name of the person employee and his corporate email.
496
+
497
+ 125
498
+ 00:10:03,000 --> 00:10:10,000
499
+ We can say that there is a functional dependency between these attributes is the determination of functional
500
+
501
+ 126
502
+ 00:10:10,000 --> 00:10:17,000
503
+ dependencies is an important part of designing databases in a relational model and in database standardization
504
+
505
+ 127
506
+ 00:10:17,000 --> 00:10:19,000
507
+ and generalization.
508
+
509
+ 128
510
+ 00:10:19,000 --> 00:10:26,000
511
+ This is important to understand because during the normalization of our tables will investigate functional
512
+
513
+ 129
514
+ 00:10:26,000 --> 00:10:32,000
515
+ dependencies between attributes, and it is crucial to identify which attributes that's in mind as the
516
+
517
+ 130
518
+ 00:10:32,000 --> 00:10:33,000
519
+ ones.
520
+
521
+ 131
522
+ 00:10:34,000 --> 00:10:37,000
523
+ Now, let's understand some more details.
524
+
525
+ 132
526
+ 00:10:37,000 --> 00:10:45,000
527
+ Functional dependency between X and Y may be called complete functional dependency and Case Y is determined
528
+
529
+ 133
530
+ 00:10:45,000 --> 00:10:47,000
531
+ by all subset of X.
532
+
533
+ 134
534
+ 00:10:47,000 --> 00:10:54,000
535
+ And again, I'm trying to simplify these concepts as much as they can, because in cuz I would tell
536
+
537
+ 135
538
+ 00:10:54,000 --> 00:10:58,000
539
+ you definition from Wikipedia, it wouldn't bring more sense.
540
+
541
+ 136
542
+ 00:10:59,000 --> 00:11:06,000
543
+ For example, imagine that you have subsets of attributes like place of dispatch delivery, destination
544
+
545
+ 137
546
+ 00:11:06,000 --> 00:11:08,000
547
+ type of cargo, cargo weight.
548
+
549
+ 138
550
+ 00:11:09,000 --> 00:11:12,000
551
+ All these attributes determine price of delivery.
552
+
553
+ 139
554
+ 00:11:12,000 --> 00:11:13,000
555
+ I agree.
556
+
557
+ 140
558
+ 00:11:14,000 --> 00:11:20,000
559
+ You can easily check this by removing any attribute from the subset and check whether the relationship
560
+
561
+ 141
562
+ 00:11:20,000 --> 00:11:28,000
563
+ is still valid because in case of cargo weight from subset of attributes, then the total price of delivery
564
+
565
+ 142
566
+ 00:11:28,000 --> 00:11:29,000
567
+ will be completely different.
568
+
569
+ 143
570
+ 00:11:30,000 --> 00:11:36,000
571
+ That's how easily I can check and ensure that there is complete functional dependency between set of
572
+
573
+ 144
574
+ 00:11:36,000 --> 00:11:38,000
575
+ judgments and another attribute.
576
+
577
+ 145
578
+ 00:11:39,000 --> 00:11:39,000
579
+ Does it make sense?
580
+
581
+ 146
582
+ 00:11:40,000 --> 00:11:46,000
583
+ And last but not the least important thing I'd like you to know about functional dependency is clear
584
+
585
+ 147
586
+ 00:11:46,000 --> 00:11:49,000
587
+ understanding of transitive dependency.
588
+
589
+ 148
590
+ 00:11:49,000 --> 00:11:50,000
591
+ Let me explain.
592
+
593
+ 149
594
+ 00:11:51,000 --> 00:12:00,000
595
+ Functional dependency X from Y may be called transitive if dependencies between X and Z and Z and Y,
596
+
597
+ 150
598
+ 00:12:01,000 --> 00:12:07,000
599
+ but there is no direct dependency between X and Y, and this case dependency will be called transitive.
600
+
601
+ 151
602
+ 00:12:08,000 --> 00:12:14,000
603
+ For example, there might be dependency between idea of employee and the DH of office, whereas this
604
+
605
+ 152
606
+ 00:12:14,000 --> 00:12:21,000
607
+ employee works and there is another dependency between Officer NI and number of whom is that office.
608
+
609
+ 153
610
+ 00:12:22,000 --> 00:12:27,000
611
+ So that means is a dependency between ideal employee and his office.
612
+
613
+ 154
614
+ 00:12:27,000 --> 00:12:28,000
615
+ Phone number is transitive.
616
+
617
+ 155
618
+ 00:12:29,000 --> 00:12:29,000
619
+ Is it clear?
620
+
621
+ 156
622
+ 00:12:31,000 --> 00:12:33,000
623
+ Now, when we know what functional dependence it is.
624
+
625
+ 157
626
+ 00:12:33,000 --> 00:12:37,000
627
+ Well, good to proceed with learning of normalization and normal forms.
628
+
629
+ 158
630
+ 00:12:38,000 --> 00:12:44,000
631
+ Let's understand first what is normalization that at least normalization is a process of structure.
632
+
633
+ 159
634
+ 00:12:44,000 --> 00:12:52,000
635
+ The database usually a relational database in accordance with serious of so-called normal forms in order
636
+
637
+ 160
638
+ 00:12:52,000 --> 00:12:56,000
639
+ to reduce data redundancy and improve data integrity.
640
+
641
+ 161
642
+ 00:12:57,000 --> 00:13:02,000
643
+ It was first proposed by Andrew Card as a part of his relational model.
644
+
645
+ 162
646
+ 00:13:03,000 --> 00:13:06,000
647
+ That the definition of database normalization may sound like this.
648
+
649
+ 163
650
+ 00:13:07,000 --> 00:13:13,000
651
+ Naming normalization is grouping and or distribution of attributes between different relationships to
652
+
653
+ 164
654
+ 00:13:13,000 --> 00:13:21,000
655
+ eliminate data anomalies during their operations was database guarantee and data integrity and consistency
656
+
657
+ 165
658
+ 00:13:22,000 --> 00:13:23,000
659
+ and optimization of DB.
660
+
661
+ 166
662
+ 00:13:24,000 --> 00:13:29,000
663
+ In the definition of normalization, we use such term as normal forms.
664
+
665
+ 167
666
+ 00:13:30,000 --> 00:13:31,000
667
+ What are normal forms?
668
+
669
+ 168
670
+ 00:13:32,000 --> 00:13:39,000
671
+ A normal form is a property of a relationship in the relational data model that describes it from the
672
+
673
+ 169
674
+ 00:13:39,000 --> 00:13:45,000
675
+ point of redundancy that can potentially lead to mistakes during the data insertion reading written
676
+
677
+ 170
678
+ 00:13:46,000 --> 00:13:47,000
679
+ data deletion.
680
+
681
+ 171
682
+ 00:13:48,000 --> 00:13:54,000
683
+ You already know about data anomalies and the other you saw examples based on this.
684
+
685
+ 172
686
+ 00:13:54,000 --> 00:13:59,000
687
+ I make a conclusion that you understand our motivation to learn normal forms.
688
+
689
+ 173
690
+ 00:14:00,000 --> 00:14:02,000
691
+ There are different normal forms.
692
+
693
+ 174
694
+ 00:14:02,000 --> 00:14:04,000
695
+ We can say that three of them.
696
+
697
+ 175
698
+ 00:14:04,000 --> 00:14:05,000
699
+ I mean, once.
700
+
701
+ 176
702
+ 00:14:06,000 --> 00:14:12,000
703
+ But we also learn to hold an overview of different normal forms in this lesson to help you understand
704
+
705
+ 177
706
+ 00:14:12,000 --> 00:14:13,000
707
+ this topic better.
708
+
709
+ 178
710
+ 00:14:14,000 --> 00:14:19,000
711
+ We're going to review normal forms from the least normalized to most normalized.
712
+
713
+ 179
714
+ 00:14:20,000 --> 00:14:25,000
715
+ In the other based harmonization and normalized form, it is also maybe referred as you, NF.
716
+
717
+ 180
718
+ 00:14:26,000 --> 00:14:31,000
719
+ Also known as normalized relation or non first normal form.
720
+
721
+ 181
722
+ 00:14:31,000 --> 00:14:38,000
723
+ This is a database data model which does meet any of the conditions of database normalization defined
724
+
725
+ 182
726
+ 00:14:38,000 --> 00:14:39,000
727
+ by the relational model.
728
+
729
+ 183
730
+ 00:14:40,000 --> 00:14:48,000
731
+ Database systems, which supports a normalized data, is sometimes called non relational or no SQL databases
732
+
733
+ 184
734
+ 00:14:48,000 --> 00:14:54,000
735
+ in the relational model and normalized relations can be considered a starting point for a process of
736
+
737
+ 185
738
+ 00:14:54,000 --> 00:14:55,000
739
+ normalization.
740
+
741
+ 186
742
+ 00:14:56,000 --> 00:15:02,000
743
+ It should not be confused with the normalization when normalization is deliberately compromised for
744
+
745
+ 187
746
+ 00:15:02,000 --> 00:15:06,000
747
+ selected tables in relational database normalization.
748
+
749
+ 188
750
+ 00:15:06,000 --> 00:15:12,000
751
+ The first form requires initial data to be viewed as relations in database systems.
752
+
753
+ 189
754
+ 00:15:12,000 --> 00:15:14,000
755
+ Relations are represented as tables.
756
+
757
+ 190
758
+ 00:15:15,000 --> 00:15:19,000
759
+ The relation view implies some constraints on the tables.
760
+
761
+ 191
762
+ 00:15:20,000 --> 00:15:25,000
763
+ No duplicates Ross Combs have unique names was in the same table.
764
+
765
+ 192
766
+ 00:15:25,000 --> 00:15:30,000
767
+ Each column has data type, which defines allowed values in the column.
768
+
769
+ 193
770
+ 00:15:31,000 --> 00:15:34,000
771
+ All rows in table have the same set of columns.
772
+
773
+ 194
774
+ 00:15:35,000 --> 00:15:36,000
775
+ As you can see.
776
+
777
+ 195
778
+ 00:15:36,000 --> 00:15:40,000
779
+ Most of the requirements are familiar to us and seems to be logical.
780
+
781
+ 196
782
+ 00:15:40,000 --> 00:15:46,000
783
+ But from the theoretical point of view, this is just a starting point following normalization, and
784
+
785
+ 197
786
+ 00:15:46,000 --> 00:15:50,000
787
+ the requirement is it should be mapped before we start applying even first normal form.
788
+
789
+ 198
790
+ 00:15:51,000 --> 00:15:54,000
791
+ You can see an example of a normalized form on the slide.
792
+
793
+ 199
794
+ 00:15:55,000 --> 00:16:01,000
795
+ This table represents a relation where transactions column is itself relation value.
796
+
797
+ 200
798
+ 00:16:01,000 --> 00:16:08,000
799
+ This is relative relation but doesn't conform to first normal form, which doesn't allow nested relations.
800
+
801
+ 201
802
+ 00:16:09,000 --> 00:16:12,000
803
+ The table is therefore a normalized.
804
+
805
+ 202
806
+ 00:16:12,000 --> 00:16:15,000
807
+ If this is clear, then let's move on.
808
+
809
+ 203
810
+ 00:16:16,000 --> 00:16:19,000
811
+ Let's see it was done in a basic normal form.
812
+
813
+ 204
814
+ 00:16:19,000 --> 00:16:23,000
815
+ The first normal form relation is in the first normal form.
816
+
817
+ 205
818
+ 00:16:23,000 --> 00:16:32,000
819
+ If and only if, no attribute domain has relations as elements or more informally, that no table column
820
+
821
+ 206
822
+ 00:16:32,000 --> 00:16:34,000
823
+ can have tables as values.
824
+
825
+ 207
826
+ 00:16:35,000 --> 00:16:41,000
827
+ But this definition tells us that the most relational databases already in the first normal form by
828
+
829
+ 208
830
+ 00:16:41,000 --> 00:16:45,000
831
+ default because it is impossible to have table value in the relational database.
832
+
833
+ 209
834
+ 00:16:46,000 --> 00:16:50,000
835
+ That's why I like another definition of the first normal form.
836
+
837
+ 210
838
+ 00:16:51,000 --> 00:16:58,000
839
+ Relationship is in first normal form if and only if each its attribute is atomic.
840
+
841
+ 211
842
+ 00:16:58,000 --> 00:16:59,000
843
+ What does it mean?
844
+
845
+ 212
846
+ 00:17:00,000 --> 00:17:01,000
847
+ I told me catching it.
848
+
849
+ 213
850
+ 00:17:02,000 --> 00:17:08,000
851
+ This means that in your business, to me and in business logic of application, there is no need to
852
+
853
+ 214
854
+ 00:17:08,000 --> 00:17:13,000
855
+ extract on the specific parts of the attribute to perform some operation, was it?
856
+
857
+ 215
858
+ 00:17:14,000 --> 00:17:16,000
859
+ Let me explain, is this on the example?
860
+
861
+ 216
862
+ 00:17:17,000 --> 00:17:21,000
863
+ Imagine that you have supply a table and each supplier has its legal address.
864
+
865
+ 217
866
+ 00:17:22,000 --> 00:17:28,000
867
+ This address contains Country City Street Building Office Number.
868
+
869
+ 218
870
+ 00:17:28,000 --> 00:17:35,000
871
+ But what if your application needs to perform operations with suppliers based on their country location?
872
+
873
+ 219
874
+ 00:17:36,000 --> 00:17:43,000
875
+ You need to be able to extract all supplies from Russia or all suppliers from India or Ukraine.
876
+
877
+ 220
878
+ 00:17:43,000 --> 00:17:47,000
879
+ Or you say how you can do this with this data model.
880
+
881
+ 221
882
+ 00:17:48,000 --> 00:17:55,000
883
+ The only way for you to do this is to extract as a whole address, then pass it inside the program and
884
+
885
+ 222
886
+ 00:17:55,000 --> 00:17:57,000
887
+ take on the country well.
888
+
889
+ 223
890
+ 00:17:57,000 --> 00:18:02,000
891
+ That's why we can say that this table violates the first normal form.
892
+
893
+ 224
894
+ 00:18:03,000 --> 00:18:06,000
895
+ Domains are stable, meet requirements of the first normal form.
896
+
897
+ 225
898
+ 00:18:07,000 --> 00:18:09,000
899
+ We need to introduce new columns in the table.
900
+
901
+ 226
902
+ 00:18:10,000 --> 00:18:16,000
903
+ Let's have separate columns for country city street building and office number.
904
+
905
+ 227
906
+ 00:18:16,000 --> 00:18:22,000
907
+ In this case, even when we need to extract suppliers for a specific city, we can do this easily by
908
+
909
+ 228
910
+ 00:18:22,000 --> 00:18:25,000
911
+ using city attributes as a search parameter.
912
+
913
+ 229
914
+ 00:18:25,000 --> 00:18:30,000
915
+ Now we can say that our table meets the requirements of the first normal form.
916
+
917
+ 230
918
+ 00:18:31,000 --> 00:18:34,000
919
+ Now, it is time for the second normal form.
920
+
921
+ 231
922
+ 00:18:35,000 --> 00:18:40,000
923
+ Revelation is in second normal form, if it fulfils is a following two requirements.
924
+
925
+ 232
926
+ 00:18:41,000 --> 00:18:46,000
927
+ It is in first normal form and it doesn't have any non-prime attribute.
928
+
929
+ 233
930
+ 00:18:47,000 --> 00:18:51,000
931
+ It is functioning dependent on any proper subset of any candidate.
932
+
933
+ 234
934
+ 00:18:51,000 --> 00:18:59,000
935
+ Key of the relation and non-prime attribute of a relation is an attribute that is not part of any candidate
936
+
937
+ 235
938
+ 00:18:59,000 --> 00:19:00,000
939
+ key of their relation.
940
+
941
+ 236
942
+ 00:19:01,000 --> 00:19:08,000
943
+ In simple words, you have to store maintains a table that relates only to the current entity, but
944
+
945
+ 237
946
+ 00:19:08,000 --> 00:19:09,000
947
+ not another one.
948
+
949
+ 238
950
+ 00:19:10,000 --> 00:19:16,000
951
+ All attributes should depend on the whole primary key, especially if this is compound primary.
952
+
953
+ 239
954
+ 00:19:16,000 --> 00:19:23,000
955
+ Key attributes should have complete functional dependency was the whole columns in compound key.
956
+
957
+ 240
958
+ 00:19:23,000 --> 00:19:26,000
959
+ But not only on its part.
960
+
961
+ 241
962
+ 00:19:26,000 --> 00:19:32,000
963
+ This might sound complicated at the beginning, but in real life it is much simpler than you think.
964
+
965
+ 242
966
+ 00:19:33,000 --> 00:19:35,000
967
+ Let me show you this one example.
968
+
969
+ 243
970
+ 00:19:35,000 --> 00:19:38,000
971
+ I believe it will be easier to understand.
972
+
973
+ 244
974
+ 00:19:38,000 --> 00:19:42,000
975
+ Here's a table of items that we sell in our store.
976
+
977
+ 245
978
+ 00:19:42,000 --> 00:19:46,000
979
+ We have category neat discount and product name.
980
+
981
+ 246
982
+ 00:19:46,000 --> 00:19:52,000
983
+ There is compound primary key that consists from category and date from this table.
984
+
985
+ 247
986
+ 00:19:52,000 --> 00:19:58,000
987
+ We can now discount that should be applied to goods from specific category at specific date.
988
+
989
+ 248
990
+ 00:19:59,000 --> 00:20:04,000
991
+ I believe that based on my explanation, you already understood what is wrong here.
992
+
993
+ 249
994
+ 00:20:04,000 --> 00:20:08,000
995
+ This gown depends only on the product category and date.
996
+
997
+ 250
998
+ 00:20:08,000 --> 00:20:14,000
999
+ That said, there is no direct dependency between discount and specific product.
1000
+
1001
+ 251
1002
+ 00:20:15,000 --> 00:20:18,000
1003
+ Product depends only on the quiet of the primary key.
1004
+
1005
+ 252
1006
+ 00:20:19,000 --> 00:20:21,000
1007
+ I mean, only on the category.
1008
+
1009
+ 253
1010
+ 00:20:21,000 --> 00:20:27,000
1011
+ There is a dependency between discount for products from specific categories at a particular date.
1012
+
1013
+ 254
1014
+ 00:20:27,000 --> 00:20:33,000
1015
+ Does it make sense because in this case, we have data redundancy?
1016
+
1017
+ 255
1018
+ 00:20:33,000 --> 00:20:36,000
1019
+ So what would be a solution here?
1020
+
1021
+ 256
1022
+ 00:20:36,000 --> 00:20:42,000
1023
+ The solution here is to make sure that complete functional dependency exists between all attributes
1024
+
1025
+ 257
1026
+ 00:20:43,000 --> 00:20:44,000
1027
+ and primary key.
1028
+
1029
+ 258
1030
+ 00:20:44,000 --> 00:20:51,000
1031
+ In our case, product has functional dependency category, but not with category and date.
1032
+
1033
+ 259
1034
+ 00:20:52,000 --> 00:20:56,000
1035
+ That's why we create two tables in the first table.
1036
+
1037
+ 260
1038
+ 00:20:56,000 --> 00:21:00,000
1039
+ We are going to have information about discount for category in particular date.
1040
+
1041
+ 261
1042
+ 00:21:00,000 --> 00:21:04,000
1043
+ And then the second table, we're going to store all products.
1044
+
1045
+ 262
1046
+ 00:21:04,000 --> 00:21:08,000
1047
+ This will allow us to have cleaner DB architecture.
1048
+
1049
+ 263
1050
+ 00:21:09,000 --> 00:21:15,000
1051
+ Let's learn certain amount form, and then the basic relation is set to meet certain normal form standards.
1052
+
1053
+ 264
1054
+ 00:21:15,000 --> 00:21:22,000
1055
+ If all the I think it's function dependent on Sullivan's primary key without any transitive dependencies,
1056
+
1057
+ 265
1058
+ 00:21:23,000 --> 00:21:29,000
1059
+ then Xenia of the third normal form is to not store data and tables that can be retrieved from other
1060
+
1061
+ 266
1062
+ 00:21:29,000 --> 00:21:30,000
1063
+ table attributes.
1064
+
1065
+ 267
1066
+ 00:21:31,000 --> 00:21:34,000
1067
+ Imagine that we have a table of two users at the university.
1068
+
1069
+ 268
1070
+ 00:21:34,000 --> 00:21:36,000
1071
+ We have such columns.
1072
+
1073
+ 269
1074
+ 00:21:36,000 --> 00:21:42,000
1075
+ I need less name, title, salary department and phone number.
1076
+
1077
+ 270
1078
+ 00:21:42,000 --> 00:21:45,000
1079
+ Is this table in the third normal form?
1080
+
1081
+ 271
1082
+ 00:21:45,000 --> 00:21:47,000
1083
+ I don't think so.
1084
+
1085
+ 272
1086
+ 00:21:47,000 --> 00:21:49,000
1087
+ Let's try to visualize dependencies here.
1088
+
1089
+ 273
1090
+ 00:21:50,000 --> 00:21:56,000
1091
+ Salary depends on the title only it doesn't depend on specific person.
1092
+
1093
+ 274
1094
+ 00:21:57,000 --> 00:22:04,000
1095
+ Specific tutor has its own title and works in concrete department, and they don't have personal work
1096
+
1097
+ 275
1098
+ 00:22:04,000 --> 00:22:10,000
1099
+ phone numbers you can contact with them using phone in the department.
1100
+
1101
+ 276
1102
+ 00:22:10,000 --> 00:22:18,000
1103
+ That's why we can say that there are different transitive dependencies, for example, transitive dependency
1104
+
1105
+ 277
1106
+ 00:22:18,000 --> 00:22:26,000
1107
+ between concrete tutor department where he or she works, and phone number there is transitive dependency
1108
+
1109
+ 278
1110
+ 00:22:26,000 --> 00:22:28,000
1111
+ between phone number and tutor.
1112
+
1113
+ 279
1114
+ 00:22:28,000 --> 00:22:29,000
1115
+ Is it clear?
1116
+
1117
+ 280
1118
+ 00:22:30,000 --> 00:22:36,000
1119
+ To remove all transitive dependencies and make sure that all relations means a certain normal form.
1120
+
1121
+ 281
1122
+ 00:22:36,000 --> 00:22:39,000
1123
+ Let's split this data between different tables.
1124
+
1125
+ 282
1126
+ 00:22:39,000 --> 00:22:46,000
1127
+ We need to create three tables to achieve this cuter table was last name, title and deportment.
1128
+
1129
+ 283
1130
+ 00:22:46,000 --> 00:22:53,000
1131
+ Title table was titled Name Unrelated Salary Department Table was its name and phone.
1132
+
1133
+ 284
1134
+ 00:22:53,000 --> 00:22:56,000
1135
+ That's it for some of my students.
1136
+
1137
+ 285
1138
+ 00:22:56,000 --> 00:22:58,000
1139
+ Nothing is changed as a first glance.
1140
+
1141
+ 286
1142
+ 00:22:59,000 --> 00:23:05,000
1143
+ We just have more tables and the relationships between different tables rather than storing old data
1144
+
1145
+ 287
1146
+ 00:23:05,000 --> 00:23:06,000
1147
+ in one table in one place.
1148
+
1149
+ 288
1150
+ 00:23:07,000 --> 00:23:09,000
1151
+ And you need to understand me, correct?
1152
+
1153
+ 289
1154
+ 00:23:09,000 --> 00:23:12,000
1155
+ Because you can store everything in one table.
1156
+
1157
+ 290
1158
+ 00:23:12,000 --> 00:23:14,000
1159
+ This is even has its own name.
1160
+
1161
+ 291
1162
+ 00:23:15,000 --> 00:23:16,000
1163
+ No sequel.
1164
+
1165
+ 292
1166
+ 00:23:16,000 --> 00:23:23,000
1167
+ Just to let you know that this is also possible, but you would lose advantage is its relational database
1168
+
1169
+ 293
1170
+ 00:23:23,000 --> 00:23:24,000
1171
+ is all for you.
1172
+
1173
+ 294
1174
+ 00:23:24,000 --> 00:23:30,000
1175
+ If you opt for relational databases, you need to clearly understand what advantage you expect to get
1176
+
1177
+ 295
1178
+ 00:23:30,000 --> 00:23:31,000
1179
+ from it.
1180
+
1181
+ 296
1182
+ 00:23:31,000 --> 00:23:39,000
1183
+ That's why the rule of thumb is to follow normal forms called later realized that certain normal form
1184
+
1185
+ 297
1186
+ 00:23:39,000 --> 00:23:46,000
1187
+ did not eliminate all undesirable data anomalies and developed a strong aversion to address this in
1188
+
1189
+ 298
1190
+ 00:23:46,000 --> 00:23:51,000
1191
+ 1974, known as voice called normal form.
1192
+
1193
+ 299
1194
+ 00:23:51,000 --> 00:23:56,000
1195
+ To be honest, yeah, many other normal forms on top of these that we have just discussed.
1196
+
1197
+ 300
1198
+ 00:23:57,000 --> 00:24:03,000
1199
+ But in my opinion, this three as the most important ones, I'm still going to make a quick overview
1200
+
1201
+ 301
1202
+ 00:24:03,000 --> 00:24:05,000
1203
+ of other normal forms, at least on the high level.
1204
+
1205
+ 302
1206
+ 00:24:06,000 --> 00:24:12,000
1207
+ In case you would be interested in more detailed explanation of all other normal forms, we don't just
1208
+
1209
+ 303
1210
+ 00:24:12,000 --> 00:24:16,000
1211
+ have any question related to normal forms reviewed in this lesson.
1212
+
1213
+ 304
1214
+ 00:24:16,000 --> 00:24:21,000
1215
+ Please ask me in the comments below this video, and I will be happy to answer you.
1216
+
1217
+ 305
1218
+ 00:24:22,000 --> 00:24:27,000
1219
+ Elementary Queen Normal fall is a subtle enhancement on certain minimal form.
1220
+
1221
+ 306
1222
+ 00:24:27,000 --> 00:24:32,000
1223
+ Thus, E K and AV tables are insert normal form by definition.
1224
+
1225
+ 307
1226
+ 00:24:33,000 --> 00:24:38,000
1227
+ This happens when there is more than one unique compound key, and they overlap.
1228
+
1229
+ 308
1230
+ 00:24:39,000 --> 00:24:43,000
1231
+ Such cases can, of course, redundant information in the overlapping columns.
1232
+
1233
+ 309
1234
+ 00:24:44,000 --> 00:24:52,000
1235
+ A table is an elementary key normal form if and only if all its elementary functional dependencies begin
1236
+
1237
+ 310
1238
+ 00:24:52,000 --> 00:24:56,000
1239
+ at whole keys or and elementary key attributes.
1240
+
1241
+ 311
1242
+ 00:24:57,000 --> 00:25:04,000
1243
+ Voice called normal form is slightly stronger version of the third normal form if relational schema
1244
+
1245
+ 312
1246
+ 00:25:04,000 --> 00:25:10,000
1247
+ is in the called normal form zone, all redundancy based on functional dependency has been removed.
1248
+
1249
+ 313
1250
+ 00:25:11,000 --> 00:25:14,000
1251
+ Also, other types of redundancy may still exist.
1252
+
1253
+ 314
1254
+ 00:25:15,000 --> 00:25:22,000
1255
+ Force normal form is concerned was a more general type of dependency known as mutually dependency.
1256
+
1257
+ 315
1258
+ 00:25:23,000 --> 00:25:31,000
1259
+ A table is enforced normal form if and only if, for every one of its non-travel lots of other dependencies.
1260
+
1261
+ 316
1262
+ 00:25:31,000 --> 00:25:39,000
1263
+ X y x is a super key that is X. This is a candidate key or a superset zero.
1264
+
1265
+ 317
1266
+ 00:25:41,000 --> 00:25:47,000
1267
+ Essential double normal form for relations is a relational database where the constraints are given
1268
+
1269
+ 318
1270
+ 00:25:47,000 --> 00:25:50,000
1271
+ by functional dependencies and joint dependencies.
1272
+
1273
+ 319
1274
+ 00:25:51,000 --> 00:25:58,000
1275
+ It lies strictly between first and fourth and fifth normal for our relations schema is an essential
1276
+
1277
+ 320
1278
+ 00:25:58,000 --> 00:26:07,000
1279
+ double normal form if and only if it is invoiced called normal form and some component of every explicitly
1280
+
1281
+ 321
1282
+ 00:26:07,000 --> 00:26:12,000
1283
+ declared during the pendency of the schema is a superkick thief's normal form.
1284
+
1285
+ 322
1286
+ 00:26:13,000 --> 00:26:15,000
1287
+ Also known as project joined.
1288
+
1289
+ 323
1290
+ 00:26:15,000 --> 00:26:22,000
1291
+ Normal form is a level of database normalization designed to reduce redundancy in relational databases,
1292
+
1293
+ 324
1294
+ 00:26:22,000 --> 00:26:29,000
1295
+ recording multivariate facts but isolate and semantically related to multiple relationships.
1296
+
1297
+ 325
1298
+ 00:26:29,000 --> 00:26:37,000
1299
+ A table is set to be in the fifth normal form if and only if every non-trivial joint dependency in that
1300
+
1301
+ 326
1302
+ 00:26:37,000 --> 00:26:40,000
1303
+ table is implied by the candidate keys.
1304
+
1305
+ 327
1306
+ 00:26:41,000 --> 00:26:49,000
1307
+ The main key normal form is a normal form used in database normalization, which requires the database
1308
+
1309
+ 328
1310
+ 00:26:49,000 --> 00:26:56,000
1311
+ contains no constraints, Aussies and domain constraints and key constraints and domain constraints
1312
+
1313
+ 329
1314
+ 00:26:56,000 --> 00:26:59,000
1315
+ insofar as a permissible values for a given attribute.
1316
+
1317
+ 330
1318
+ 00:27:00,000 --> 00:27:07,000
1319
+ While a key constraint specifies is, it attributes that uniquely identify a role in a given table.
1320
+
1321
+ 331
1322
+ 00:27:08,000 --> 00:27:15,000
1323
+ The new key normal form is achieved when every constraint on the relation is a logical consequence of
1324
+
1325
+ 332
1326
+ 00:27:15,000 --> 00:27:21,000
1327
+ the definition of keys and the means and enforcing key and the main, the restraints and conditions
1328
+
1329
+ 333
1330
+ 00:27:22,000 --> 00:27:24,000
1331
+ causes all constraints to be met.
1332
+
1333
+ 334
1334
+ 00:27:24,000 --> 00:27:28,000
1335
+ Thus, it avoids all non temporal anomalies.
1336
+
1337
+ 335
1338
+ 00:27:29,000 --> 00:27:29,000
1339
+ Six.
1340
+
1341
+ 336
1342
+ 00:27:29,000 --> 00:27:38,000
1343
+ Normal form is intended to decompose relation variables to irreducible components, though this may
1344
+
1345
+ 337
1346
+ 00:27:38,000 --> 00:27:41,000
1347
+ be relatively unimportant for non temporal relation variables.
1348
+
1349
+ 338
1350
+ 00:27:42,000 --> 00:27:48,000
1351
+ It can be important when dealing with temporal variables or other internal data.
1352
+
1353
+ 339
1354
+ 00:27:48,000 --> 00:27:57,000
1355
+ A table is in six normal form if and only if it satisfies no non-trivial joint dependencies at all.
1356
+
1357
+ 340
1358
+ 00:27:57,000 --> 00:28:05,000
1359
+ Where, as before and during dependencies is trivial if and only if at least one of the projections
1360
+
1361
+ 341
1362
+ 00:28:05,000 --> 00:28:10,000
1363
+ involved is taken over a set of all attributes of the table concerned.
1364
+
1365
+ 342
1366
+ 00:28:11,000 --> 00:28:18,000
1367
+ As you see from high level overview, it might be not so easy to understand the practical need and value
1368
+
1369
+ 343
1370
+ 00:28:18,000 --> 00:28:22,000
1371
+ of each of these normal forms to know how to apply.
1372
+
1373
+ 344
1374
+ 00:28:22,000 --> 00:28:26,000
1375
+ Those probably separate lesson is needed for each.
1376
+
1377
+ 345
1378
+ 00:28:26,000 --> 00:28:32,000
1379
+ But considering the fact that they are not so popular in comparison with the first three normal forms,
1380
+
1381
+ 346
1382
+ 00:28:32,000 --> 00:28:35,000
1383
+ probably I will not cover them in detail in this lesson.
1384
+
1385
+ 347
1386
+ 00:28:36,000 --> 00:28:43,000
1387
+ I strongly recommend you to apply first three normal forms during database architecture and during creation
1388
+
1389
+ 348
1390
+ 00:28:43,000 --> 00:28:44,000
1391
+ of each table.
1392
+
1393
+ 349
1394
+ 00:28:44,000 --> 00:28:50,000
1395
+ I might add, means that knowing of all other normal forms by heart is not so critical.
1396
+
1397
+ 350
1398
+ 00:28:50,000 --> 00:28:56,000
1399
+ On the slide, you can see comparative analysis and the last, but not the least, things that I wanted
1400
+
1401
+ 351
1402
+ 00:28:56,000 --> 00:28:59,000
1403
+ to discuss with you today is the normalization.
1404
+
1405
+ 352
1406
+ 00:29:00,000 --> 00:29:07,000
1407
+ No normalization is a strategy used on the previously normalized database to increase performance in
1408
+
1409
+ 353
1410
+ 00:29:07,000 --> 00:29:07,000
1411
+ computing.
1412
+
1413
+ 354
1414
+ 00:29:07,000 --> 00:29:14,000
1415
+ The normalization is a process of trying to improve the performance of a database and the expense of
1416
+
1417
+ 355
1418
+ 00:29:14,000 --> 00:29:20,000
1419
+ losing some light performance by adding redundant corpus of data all by group and later.
1420
+
1421
+ 356
1422
+ 00:29:21,000 --> 00:29:27,000
1423
+ The normalization difference from a normalized form means that the normalization benefits can only be
1424
+
1425
+ 357
1426
+ 00:29:27,000 --> 00:29:32,000
1427
+ fully realized on the data model that is otherwise normalized.
1428
+
1429
+ 358
1430
+ 00:29:33,000 --> 00:29:35,000
1431
+ So how we can improve performance.
1432
+
1433
+ 359
1434
+ 00:29:36,000 --> 00:29:43,000
1435
+ Imagine that we have multiple tables, we have table with soccer clubs, we have a table with soccer
1436
+
1437
+ 360
1438
+ 00:29:43,000 --> 00:29:50,000
1439
+ leagues and we have table was match data that should contain information about me, home team and guests.
1440
+
1441
+ 361
1442
+ 00:29:52,000 --> 00:29:55,000
1443
+ We also saw a lot of other information about teams and matches.
1444
+
1445
+ 362
1446
+ 00:29:56,000 --> 00:30:04,000
1447
+ Now imagine that to extract much data for the home, the week moments, we need to query suite tables
1448
+
1449
+ 363
1450
+ 00:30:04,000 --> 00:30:06,000
1451
+ and database for each row.
1452
+
1453
+ 364
1454
+ 00:30:06,000 --> 00:30:11,000
1455
+ We may have spouses of matches and not only soccer.
1456
+
1457
+ 365
1458
+ 00:30:11,000 --> 00:30:18,000
1459
+ I simplified the original example a bit, but imagine that you have multiple sports and you have teams
1460
+
1461
+ 366
1462
+ 00:30:18,000 --> 00:30:21,000
1463
+ and different sports and much more leagues.
1464
+
1465
+ 367
1466
+ 00:30:21,000 --> 00:30:25,000
1467
+ This is literally crazy amount of data each day.
1468
+
1469
+ 368
1470
+ 00:30:25,000 --> 00:30:33,000
1471
+ Making Junqueras findings and mappings in different tables may take some time, while it might be not
1472
+
1473
+ 369
1474
+ 00:30:33,000 --> 00:30:36,000
1475
+ so dramatic while querying a few records.
1476
+
1477
+ 370
1478
+ 00:30:36,000 --> 00:30:44,000
1479
+ It is different when you query a lot of records, and that is a day we are receiving benefits by certain
1480
+
1481
+ 371
1482
+ 00:30:44,000 --> 00:30:47,000
1483
+ entities in different tables without any duplication.
1484
+
1485
+ 372
1486
+ 00:30:48,000 --> 00:30:55,000
1487
+ But when you query Susan's rose and do join requests with different tables, this might take some time
1488
+
1489
+ 373
1490
+ 00:30:56,000 --> 00:31:00,000
1491
+ and to save time by not comparing other tables to get data you need.
1492
+
1493
+ 374
1494
+ 00:31:00,000 --> 00:31:08,000
1495
+ We at data redundancy on purpose and understand know how better performance of reading operations is
1496
+
1497
+ 375
1498
+ 00:31:08,000 --> 00:31:08,000
1499
+ achieved.
1500
+
1501
+ 376
1502
+ 00:31:09,000 --> 00:31:17,000
1503
+ Imagine you need to read all matches, data in normalized database and you query in different tables
1504
+
1505
+ 377
1506
+ 00:31:17,000 --> 00:31:25,000
1507
+ and you normalize database, you request all data from one place, then distanza mean a year of generalization.
1508
+
1509
+ 378
1510
+ 00:31:26,000 --> 00:31:30,000
1511
+ But remember, this is something what should be done super carefully.
1512
+
1513
+ 379
1514
+ 00:31:30,000 --> 00:31:37,000
1515
+ You need to be sure what benefits you will get from generalization, and it is recommended to be specific
1516
+
1517
+ 380
1518
+ 00:31:37,000 --> 00:31:38,000
1519
+ in order.
1520
+
1521
+ 381
1522
+ 00:31:38,000 --> 00:31:44,000
1523
+ You could understand how many seconds you would win in performance after the normalization.
1524
+
1525
+ 382
1526
+ 00:31:44,000 --> 00:31:50,000
1527
+ I did this several times in my own projects, and I can say that this is a technique that's really worth
1528
+
1529
+ 383
1530
+ 00:31:50,000 --> 00:31:53,000
1531
+ of your attention if you are going to use a smart.
1532
+
1533
+ 384
1534
+ 00:31:54,000 --> 00:31:57,000
1535
+ That's all what I wanted to share with you in this lesson.
1536
+
1537
+ 385
1538
+ 00:31:57,000 --> 00:32:01,000
1539
+ Let's recap what we have learned to date in this lesson.
1540
+
1541
+ 386
1542
+ 00:32:01,000 --> 00:32:08,000
1543
+ You've learned what data anomalies are we have learned in session update and deletion anomalies.
1544
+
1545
+ 387
1546
+ 00:32:09,000 --> 00:32:12,000
1547
+ Also, we reviewed the main concept in dependencies theory.
1548
+
1549
+ 388
1550
+ 00:32:13,000 --> 00:32:17,000
1551
+ Now you know what a complete, unknown, complete functional dependency is.
1552
+
1553
+ 389
1554
+ 00:32:18,000 --> 00:32:26,000
1555
+ After that, we learned what normalization is on examples of used normal forms and incentives was lesson
1556
+
1557
+ 390
1558
+ 00:32:26,000 --> 00:32:27,000
1559
+ I explained.
1560
+
1561
+ 391
1562
+ 00:32:27,000 --> 00:32:30,000
1563
+ What generalization is that?
1564
+
1565
+ 392
1566
+ 00:32:30,000 --> 00:32:31,000
1567
+ So for this lesson?
1568
+
1569
+ 393
1570
+ 00:32:31,000 --> 00:32:32,000
1571
+ Thanks a lot for your attention.
1572
+
1573
+ 394
1574
+ 00:32:33,000 --> 00:32:35,000
1575
+ Have a great day and see you in the next lesson.
1576
+
48 - SQL/001 MySQL-Documentation-about-statements.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://dev.mysql.com/doc/refman/8.0/en/create-view.html
48 - SQL/001 Query-Examples-that-were-shown-in-the-lesson.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/sql_queries/ddl
48 - SQL/001 SQL General Overview & DDL_en.srt ADDED
@@ -0,0 +1,976 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:05,000 --> 00:00:06,000
3
+ Hello, Kim.
4
+
5
+ 2
6
+ 00:00:06,000 --> 00:00:12,000
7
+ Today, we're going to have a very important lesson in the lesson we are going to learn the basics of
8
+
9
+ 3
10
+ 00:00:12,000 --> 00:00:13,000
11
+ structured query language.
12
+
13
+ 4
14
+ 00:00:14,000 --> 00:00:18,000
15
+ I'm going to explain you what it is and why it is important to know it.
16
+
17
+ 5
18
+ 00:00:19,000 --> 00:00:22,000
19
+ The work was databases will start from the very basics.
20
+
21
+ 6
22
+ 00:00:23,000 --> 00:00:25,000
23
+ We'll learn what skill is in general.
24
+
25
+ 7
26
+ 00:00:26,000 --> 00:00:30,000
27
+ And after that, we'll focus on data, definition, language and skill.
28
+
29
+ 8
30
+ 00:00:31,000 --> 00:00:35,000
31
+ Don't worry, we'll not have only one lesson about sequel.
32
+
33
+ 9
34
+ 00:00:35,000 --> 00:00:38,000
35
+ Still, there will be other lessons to learn.
36
+
37
+ 10
38
+ 00:00:38,000 --> 00:00:44,000
39
+ But today we're going to build a basement for our further learning in the lesson we're going to learn
40
+
41
+ 11
42
+ 00:00:44,000 --> 00:00:45,000
43
+ what sequel is.
44
+
45
+ 12
46
+ 00:00:45,000 --> 00:00:47,000
47
+ I will explain what sequels have.
48
+
49
+ 13
50
+ 00:00:47,000 --> 00:00:48,000
51
+ Languages are.
52
+
53
+ 14
54
+ 00:00:49,000 --> 00:00:52,000
55
+ This will give you insights on what we are going to learn in this course.
56
+
57
+ 15
58
+ 00:00:53,000 --> 00:00:58,000
59
+ After holding an overview of sequel language, we'll jump to learning of the first sequel.
60
+
61
+ 16
62
+ 00:00:58,000 --> 00:01:04,000
63
+ Sub Language will learn data definition language in this video will review different statements with
64
+
65
+ 17
66
+ 00:01:04,000 --> 00:01:08,000
67
+ great alter, rename, truncate and drop statements.
68
+
69
+ 18
70
+ 00:01:09,000 --> 00:01:16,000
71
+ Also on the real examples you are going to see how we can create these statements and execute them against
72
+
73
+ 19
74
+ 00:01:16,000 --> 00:01:17,000
75
+ our database.
76
+
77
+ 20
78
+ 00:01:17,000 --> 00:01:18,000
79
+ Enough docs.
80
+
81
+ 21
82
+ 00:01:19,000 --> 00:01:22,000
83
+ US start our lesson and to start our lesson.
84
+
85
+ 22
86
+ 00:01:22,000 --> 00:01:26,000
87
+ Let's understand what sequel is and what we are going to learn in this course.
88
+
89
+ 23
90
+ 00:01:27,000 --> 00:01:29,000
91
+ Sequel stands for structured query language.
92
+
93
+ 24
94
+ 00:01:30,000 --> 00:01:36,000
95
+ It is the main specific language used to manage data held in the relational database management system.
96
+
97
+ 25
98
+ 00:01:36,000 --> 00:01:42,000
99
+ Sequel was one of the first commercial languages to use anger cause relational model.
100
+
101
+ 26
102
+ 00:01:43,000 --> 00:01:50,000
103
+ The model was described in his influential 1970 paper, a relational model of data for large shared
104
+
105
+ 27
106
+ 00:01:51,000 --> 00:01:51,000
107
+ data banks.
108
+
109
+ 28
110
+ 00:01:52,000 --> 00:02:00,000
111
+ Despite not entirely adhering to the relational model as described by code, it became most widely used.
112
+
113
+ 29
114
+ 00:02:00,000 --> 00:02:03,000
115
+ Database language sequel became a standard.
116
+
117
+ 30
118
+ 00:02:03,000 --> 00:02:09,000
119
+ Often, the American National Standards Institute in nineteen eighty six and all was the International
120
+
121
+ 31
122
+ 00:02:09,000 --> 00:02:13,000
123
+ Organization for Standardization in 1987.
124
+
125
+ 32
126
+ 00:02:13,000 --> 00:02:19,000
127
+ And because standardization of sequel wasn't done since its creation defines relational database management
128
+
129
+ 33
130
+ 00:02:19,000 --> 00:02:22,000
131
+ systems invented their own differences.
132
+
133
+ 34
134
+ 00:02:22,000 --> 00:02:29,000
135
+ Despite the existence of standards, most sequel code requires at least some minor changes before being
136
+
137
+ 35
138
+ 00:02:29,000 --> 00:02:31,000
139
+ ported to different database systems.
140
+
141
+ 36
142
+ 00:02:32,000 --> 00:02:39,000
143
+ So SQL itself is set of operators that allow us to interact with database management system, query
144
+
145
+ 37
146
+ 00:02:39,000 --> 00:02:42,000
147
+ data in it and perform other operations.
148
+
149
+ 38
150
+ 00:02:43,000 --> 00:02:49,000
151
+ These different statements and operators informally can be grouped and classified as different sublineages.
152
+
153
+ 39
154
+ 00:02:50,000 --> 00:02:58,000
155
+ Ziya Data Definition Language It is a syntax for creating and modifying database objects such as tables,
156
+
157
+ 40
158
+ 00:02:58,000 --> 00:03:06,000
159
+ indexes, etc. DDL statements are similar to a computer programming language for defining data structures,
160
+
161
+ 41
162
+ 00:03:06,000 --> 00:03:09,000
163
+ especially database schemas.
164
+
165
+ 42
166
+ 00:03:09,000 --> 00:03:14,000
167
+ Common examples of these statements include create, alter and draw.
168
+
169
+ 43
170
+ 00:03:15,000 --> 00:03:22,000
171
+ Data manipulation language, is this a set of statements that they used for adding deleting dating data
172
+
173
+ 44
174
+ 00:03:22,000 --> 00:03:23,000
175
+ in a database?
176
+
177
+ 45
178
+ 00:03:23,000 --> 00:03:27,000
179
+ Common examples of these misstatements include select insert.
180
+
181
+ 46
182
+ 00:03:27,000 --> 00:03:29,000
183
+ Update Delete.
184
+
185
+ 47
186
+ 00:03:30,000 --> 00:03:37,000
187
+ Data control language, it is a syntax that is used to control access to data stored in a database.
188
+
189
+ 48
190
+ 00:03:37,000 --> 00:03:42,000
191
+ Examples of this sale include grant and revoke statements.
192
+
193
+ 49
194
+ 00:03:43,000 --> 00:03:47,000
195
+ And last but not least siblings, which is transaction control language.
196
+
197
+ 50
198
+ 00:03:47,000 --> 00:03:53,000
199
+ This language group statements to manage transactions in databases and one examples of this.
200
+
201
+ 51
202
+ 00:03:53,000 --> 00:03:57,000
203
+ It is worth to mention commit, rollback and safe points.
204
+
205
+ 52
206
+ 00:03:58,000 --> 00:04:05,000
207
+ Based on this, we can make a conclusion that the scope of sequel includes data query, data manipulation,
208
+
209
+ 53
210
+ 00:04:05,000 --> 00:04:13,000
211
+ data definition, data access control, transaction management and managing database objects in our
212
+
213
+ 54
214
+ 00:04:13,000 --> 00:04:14,000
215
+ course on real examples.
216
+
217
+ 55
218
+ 00:04:14,000 --> 00:04:18,000
219
+ We are going to learn how to work with different groups of statements.
220
+
221
+ 56
222
+ 00:04:19,000 --> 00:04:19,000
223
+ OK.
224
+
225
+ 57
226
+ 00:04:20,000 --> 00:04:25,000
227
+ I believe that now you understand what a sequel is and what we are going to learn.
228
+
229
+ 58
230
+ 00:04:25,000 --> 00:04:32,000
231
+ And as we announced an agenda of this meeting, let's start learning the deal now and we will start
232
+
233
+ 59
234
+ 00:04:32,000 --> 00:04:33,000
235
+ from the first statement.
236
+
237
+ 60
238
+ 00:04:34,000 --> 00:04:35,000
239
+ It is a great statement.
240
+
241
+ 61
242
+ 00:04:36,000 --> 00:04:42,000
243
+ The general structure of statement is the following you write create first.
244
+
245
+ 62
246
+ 00:04:42,000 --> 00:04:49,000
247
+ After that, you specify what you want to create, whether it is a database schema to move you index.
248
+
249
+ 63
250
+ 00:04:50,000 --> 00:04:56,000
251
+ After that, you put name of the database object that you want to create and optionally you can put
252
+
253
+ 64
254
+ 00:04:56,000 --> 00:04:57,000
255
+ different options.
256
+
257
+ 65
258
+ 00:04:58,000 --> 00:04:59,000
259
+ Let's review a few queries with you.
260
+
261
+ 66
262
+ 00:05:00,000 --> 00:05:03,000
263
+ Degrade database We need to use the following construct.
264
+
265
+ 67
266
+ 00:05:04,000 --> 00:05:06,000
267
+ We start from create keywords.
268
+
269
+ 68
270
+ 00:05:06,000 --> 00:05:10,000
271
+ After that, we indicate that we want to create a database.
272
+
273
+ 69
274
+ 00:05:11,000 --> 00:05:19,000
275
+ And by the way, in my school you can use both options is a create schema or create database.
276
+
277
+ 70
278
+ 00:05:19,000 --> 00:05:20,000
279
+ They are similar.
280
+
281
+ 71
282
+ 00:05:21,000 --> 00:05:24,000
283
+ After that, we need to specify name of the database.
284
+
285
+ 72
286
+ 00:05:24,000 --> 00:05:29,000
287
+ Usually in sequel, we use single quotes for all string values.
288
+
289
+ 73
290
+ 00:05:30,000 --> 00:05:33,000
291
+ That's why I put the name of our DB in quotes.
292
+
293
+ 74
294
+ 00:05:34,000 --> 00:05:37,000
295
+ Basically, this is enough to create a database.
296
+
297
+ 75
298
+ 00:05:38,000 --> 00:05:41,000
299
+ But additionally, we can add more sinks in the statement.
300
+
301
+ 76
302
+ 00:05:42,000 --> 00:05:48,000
303
+ We can add a condition to make sure that we wouldn't even try to create a table if it exists already
304
+
305
+ 77
306
+ 00:05:49,000 --> 00:05:49,000
307
+ for this.
308
+
309
+ 78
310
+ 00:05:49,000 --> 00:05:57,000
311
+ Optionally, we can add, if not exist and the different create options that can be specified separately.
312
+
313
+ 79
314
+ 00:05:58,000 --> 00:06:03,000
315
+ For example, you know that sometimes we also want to specify charset and collation.
316
+
317
+ 80
318
+ 00:06:03,000 --> 00:06:09,000
319
+ You can write default character set, followed by Charsadda, that you want to use.
320
+
321
+ 81
322
+ 00:06:09,000 --> 00:06:15,000
323
+ And after that, you can write code and specify collation that will be used for this charset.
324
+
325
+ 82
326
+ 00:06:16,000 --> 00:06:20,000
327
+ Now this is complete query to be executed against database.
328
+
329
+ 83
330
+ 00:06:21,000 --> 00:06:26,000
331
+ Let me start sharing my screen to execute this query together with you.
332
+
333
+ 84
334
+ 00:06:26,000 --> 00:06:31,000
335
+ I'm going to show you how you can execute cycle queries from my SQL workbench.
336
+
337
+ 85
338
+ 00:06:32,000 --> 00:06:37,000
339
+ If you don't have my SQL server installed and also you don't have my SQL workbench in your computer,
340
+
341
+ 86
342
+ 00:06:38,000 --> 00:06:44,000
343
+ please refer to the previous classes where we together installed all required applications for my school
344
+
345
+ 87
346
+ 00:06:44,000 --> 00:06:46,000
347
+ relational database management system.
348
+
349
+ 88
350
+ 00:06:47,000 --> 00:06:52,000
351
+ You can execute any SQL query you wish directly from sequel editor.
352
+
353
+ 89
354
+ 00:06:53,000 --> 00:07:00,000
355
+ Just click on this icon that is called Create New SQL tab for executing queries and Knewthat will be
356
+
357
+ 90
358
+ 00:07:00,000 --> 00:07:01,000
359
+ opened.
360
+
361
+ 91
362
+ 00:07:01,000 --> 00:07:07,000
363
+ Now you can type any query you wish can save time during this video lesson.
364
+
365
+ 92
366
+ 00:07:07,000 --> 00:07:12,000
367
+ I already pasted here's a query removed to create a database.
368
+
369
+ 93
370
+ 00:07:12,000 --> 00:07:17,000
371
+ Press a pause for a few seconds if you need to times square it in a sequel editor.
372
+
373
+ 94
374
+ 00:07:18,000 --> 00:07:24,000
375
+ One more important thing the mansion here is that sequel is not case sensitive.
376
+
377
+ 95
378
+ 00:07:24,000 --> 00:07:31,000
379
+ That means that no matter how you would spell create, it would still mean the same.
380
+
381
+ 96
382
+ 00:07:31,000 --> 00:07:35,000
383
+ You can write it with capital letters all lowercase.
384
+
385
+ 97
386
+ 00:07:35,000 --> 00:07:38,000
387
+ Technically speaking, and doesn't matter at all.
388
+
389
+ 98
390
+ 00:07:38,000 --> 00:07:44,000
391
+ But still, there is a common practice to write all sequel key words with capital letters.
392
+
393
+ 99
394
+ 00:07:45,000 --> 00:07:49,000
395
+ If you are ready, let's execute the query to execute all commands.
396
+
397
+ 100
398
+ 00:07:49,000 --> 00:07:57,000
399
+ Since this SQL file, you have to click this lightning icon if you want to execute on the selected commands.
400
+
401
+ 101
402
+ 00:07:57,000 --> 00:08:03,000
403
+ We have to select first SQL instruction, and after that, click on Lightning Icon.
404
+
405
+ 102
406
+ 00:08:04,000 --> 00:08:10,000
407
+ And if you want to execute only one statement on the keyboard's cursor, you have to click this icon.
408
+
409
+ 103
410
+ 00:08:11,000 --> 00:08:16,000
411
+ I execute query after it has been successfully executed.
412
+
413
+ 104
414
+ 00:08:16,000 --> 00:08:21,000
415
+ I click Refresh Icon and I see that new database is created.
416
+
417
+ 105
418
+ 00:08:21,000 --> 00:08:28,000
419
+ Let me select this database to make sure that all other queries will be executed against this database.
420
+
421
+ 106
422
+ 00:08:29,000 --> 00:08:36,000
423
+ I am going to save each query that will review today with you in a separate file in attachments to the
424
+
425
+ 107
426
+ 00:08:36,000 --> 00:08:39,000
427
+ lesson, you will be able to find all these queries.
428
+
429
+ 108
430
+ 00:08:40,000 --> 00:08:43,000
431
+ Now, let's learn how we can create table.
432
+
433
+ 109
434
+ 00:08:44,000 --> 00:08:50,000
435
+ I believe you already understood the general structure of great query, but still on the slide you can
436
+
437
+ 110
438
+ 00:08:50,000 --> 00:08:53,000
439
+ see specifics of create table statement.
440
+
441
+ 111
442
+ 00:08:53,000 --> 00:08:57,000
443
+ This query is much more complicated than create database query.
444
+
445
+ 112
446
+ 00:08:57,000 --> 00:09:04,000
447
+ We can come up with some different combinations and variations that it will take more than one slides
448
+
449
+ 113
450
+ 00:09:04,000 --> 00:09:05,000
451
+ to describe all of them.
452
+
453
+ 114
454
+ 00:09:06,000 --> 00:09:09,000
455
+ That's why I would try to share with you.
456
+
457
+ 115
458
+ 00:09:09,000 --> 00:09:15,000
459
+ The most general and high level structure of this statement mentions the most important things, in
460
+
461
+ 116
462
+ 00:09:15,000 --> 00:09:16,000
463
+ my opinion.
464
+
465
+ 117
466
+ 00:09:16,000 --> 00:09:22,000
467
+ In case you would like to know more details, you can always refer to the official documentation.
468
+
469
+ 118
470
+ 00:09:23,000 --> 00:09:31,000
471
+ Basically, when you try to create stable followed by table name and after that parentheses, we have
472
+
473
+ 119
474
+ 00:09:31,000 --> 00:09:37,000
475
+ to list all columns with their data types specifying size for each field.
476
+
477
+ 120
478
+ 00:09:37,000 --> 00:09:46,000
479
+ If needed, we can specify primary key column name and if we need, we can create index by specifying
480
+
481
+ 121
482
+ 00:09:46,000 --> 00:09:54,000
483
+ its style column name sorting that might be easier ascendent understanding and its visibility.
484
+
485
+ 122
486
+ 00:09:55,000 --> 00:10:01,000
487
+ Just to remind you that it might be visible or not visible in case you're not familiar with indexes
488
+
489
+ 123
490
+ 00:10:01,000 --> 00:10:01,000
491
+ and databases.
492
+
493
+ 124
494
+ 00:10:02,000 --> 00:10:08,000
495
+ Please make sure you watched the previous lesson in this course about indexes in databases.
496
+
497
+ 125
498
+ 00:10:08,000 --> 00:10:16,000
499
+ We reviewed all properties of indexes, any details on the example you can see and after you listed
500
+
501
+ 126
502
+ 00:10:16,000 --> 00:10:20,000
503
+ all columns and added necessary properties to columns.
504
+
505
+ 127
506
+ 00:10:20,000 --> 00:10:24,000
507
+ We can specify engine type that we want to use for this table.
508
+
509
+ 128
510
+ 00:10:25,000 --> 00:10:32,000
511
+ I believe you remember that we can specify charset and collation on different levels, the specified
512
+
513
+ 129
514
+ 00:10:32,000 --> 00:10:35,000
515
+ SHAZAD and collation on the table level.
516
+
517
+ 130
518
+ 00:10:35,000 --> 00:10:38,000
519
+ You can put these statements at the end of the query.
520
+
521
+ 131
522
+ 00:10:38,000 --> 00:10:39,000
523
+ That's it.
524
+
525
+ 132
526
+ 00:10:40,000 --> 00:10:43,000
527
+ Let's execute real query against database.
528
+
529
+ 133
530
+ 00:10:44,000 --> 00:10:50,000
531
+ Here, an example you can see SQL create statement that will create separate table for us was named
532
+
533
+ 134
534
+ 00:10:50,000 --> 00:10:52,000
535
+ best table in this database.
536
+
537
+ 135
538
+ 00:10:53,000 --> 00:10:55,000
539
+ Pay attention to a separate database.
540
+
541
+ 136
542
+ 00:10:55,000 --> 00:11:02,000
543
+ Name and table name was Dot in case you selected this database in my school workbench.
544
+
545
+ 137
546
+ 00:11:02,000 --> 00:11:10,000
547
+ There is no need to specify the full table name to make sure it will be created in the current database.
548
+
549
+ 138
550
+ 00:11:11,000 --> 00:11:16,000
551
+ In this case, this declaration is redundant and you can remove it.
552
+
553
+ 139
554
+ 00:11:16,000 --> 00:11:18,000
555
+ Result will be the same.
556
+
557
+ 140
558
+ 00:11:19,000 --> 00:11:22,000
559
+ Here is a list of attributes that I want to have in my table.
560
+
561
+ 141
562
+ 00:11:23,000 --> 00:11:28,000
563
+ Next to an attribute, I specify all properties related to this column.
564
+
565
+ 142
566
+ 00:11:29,000 --> 00:11:36,000
567
+ It is a type and not now and all the incremented first name attribute is of type word.
568
+
569
+ 143
570
+ 00:11:36,000 --> 00:11:42,000
571
+ Char was maximum lengths of forty five with no default value and so on.
572
+
573
+ 144
574
+ 00:11:43,000 --> 00:11:51,000
575
+ Primary key is ID column I create a unique index was name email, unique for email column with ascending
576
+
577
+ 145
578
+ 00:11:51,000 --> 00:11:57,000
579
+ order and also I specify engine charset and collation.
580
+
581
+ 146
582
+ 00:11:57,000 --> 00:11:58,000
583
+ Is that clear?
584
+
585
+ 147
586
+ 00:11:59,000 --> 00:12:05,000
587
+ And even in case you have any questions, you can always ask your questions in comments to the reader,
588
+
589
+ 148
590
+ 00:12:05,000 --> 00:12:07,000
591
+ and I will be happy to answer.
592
+
593
+ 149
594
+ 00:12:08,000 --> 00:12:13,000
595
+ Let's execute this query and we seize that query has been successfully executed.
596
+
597
+ 150
598
+ 00:12:13,000 --> 00:12:17,000
599
+ After we refresh, we seize a test table is created.
600
+
601
+ 151
602
+ 00:12:21,000 --> 00:12:25,000
603
+ You already saw how to create index during the creation of the table.
604
+
605
+ 152
606
+ 00:12:26,000 --> 00:12:31,000
607
+ But let's imagine that we create a table and we simply forgot to create an index.
608
+
609
+ 153
610
+ 00:12:32,000 --> 00:12:34,000
611
+ We still can create index afterwards.
612
+
613
+ 154
614
+ 00:12:35,000 --> 00:12:38,000
615
+ Let's learn how to do this on this slide.
616
+
617
+ 155
618
+ 00:12:38,000 --> 00:12:42,000
619
+ You can see structure of create in the statement you're in the creation.
620
+
621
+ 156
622
+ 00:12:42,000 --> 00:12:46,000
623
+ We need to specify which type of index we would like to create.
624
+
625
+ 157
626
+ 00:12:46,000 --> 00:12:51,000
627
+ The difference between these types was covered in the lesson about indexes.
628
+
629
+ 158
630
+ 00:12:52,000 --> 00:13:00,000
631
+ You specify index name and on which table and column you would like to create this and this on the slide.
632
+
633
+ 159
634
+ 00:13:00,000 --> 00:13:07,000
635
+ You can also notice that there might be different index options, index types, algorithm options and
636
+
637
+ 160
638
+ 00:13:07,000 --> 00:13:08,000
639
+ lock options.
640
+
641
+ 161
642
+ 00:13:09,000 --> 00:13:12,000
643
+ Let's grade index for our new table.
644
+
645
+ 162
646
+ 00:13:12,000 --> 00:13:17,000
647
+ Just for the sake of example, let's create an index for the first name column.
648
+
649
+ 163
650
+ 00:13:18,000 --> 00:13:19,000
651
+ I'm here on the screen.
652
+
653
+ 164
654
+ 00:13:19,000 --> 00:13:23,000
655
+ You can see a simplified version of Create Index.
656
+
657
+ 165
658
+ 00:13:23,000 --> 00:13:30,000
659
+ I specify name of my index table column in this table and index option.
660
+
661
+ 166
662
+ 00:13:30,000 --> 00:13:32,000
663
+ Let me ask the this query.
664
+
665
+ 167
666
+ 00:13:33,000 --> 00:13:41,000
667
+ We see the query has been executed successfully, but it is obvious that no rows were affected to make
668
+
669
+ 168
670
+ 00:13:41,000 --> 00:13:44,000
671
+ sure that we really created the index when needed.
672
+
673
+ 169
674
+ 00:13:44,000 --> 00:13:52,000
675
+ I open all the table and on index type I can see as an index was my name that I have just great.
676
+
677
+ 170
678
+ 00:13:53,000 --> 00:13:55,000
679
+ That's how easily I can create indexes.
680
+
681
+ 171
682
+ 00:13:56,000 --> 00:14:02,000
683
+ Also, index might be added as part of output table instruction, but we are going to use this later
684
+
685
+ 172
686
+ 00:14:02,000 --> 00:14:07,000
687
+ in our lesson when we'll start learning of all the statement and details.
688
+
689
+ 173
690
+ 00:14:08,000 --> 00:14:15,000
691
+ One of my main goal as a tutor is not just to teach you each possible combination of swearing, but
692
+
693
+ 174
694
+ 00:14:15,000 --> 00:14:22,000
695
+ also I have to teach you how to understand the documentation in order you could easily proceed yourself
696
+
697
+ 175
698
+ 00:14:22,000 --> 00:14:23,000
699
+ education.
700
+
701
+ 176
702
+ 00:14:23,000 --> 00:14:26,000
703
+ The Gazette reviewed few queries already.
704
+
705
+ 177
706
+ 00:14:27,000 --> 00:14:33,000
707
+ And for example, if you need to create view via a sequel, you don't need to open this lesson.
708
+
709
+ 178
710
+ 00:14:33,000 --> 00:14:39,000
711
+ You can always open the official documentation of specific relational database management system and
712
+
713
+ 179
714
+ 00:14:39,000 --> 00:14:40,000
715
+ check the details.
716
+
717
+ 180
718
+ 00:14:41,000 --> 00:14:46,000
719
+ For example, now on the screen, you can see documentation page of my school.
720
+
721
+ 181
722
+ 00:14:47,000 --> 00:14:53,000
723
+ From this page, you can find general construction of create, view statement and all possible options.
724
+
725
+ 182
726
+ 00:14:54,000 --> 00:15:00,000
727
+ We have just reviewed similar ones, and I believe you'll really understand how to read this syntax
728
+
729
+ 183
730
+ 00:15:00,000 --> 00:15:01,000
731
+ by analogy.
732
+
733
+ 184
734
+ 00:15:02,000 --> 00:15:08,000
735
+ Press a pause for a minute, if needed, or just feel free to explore attachments to the lesson and
736
+
737
+ 185
738
+ 00:15:08,000 --> 00:15:12,000
739
+ find this link to the official documentation that I've shared with you.
740
+
741
+ 186
742
+ 00:15:13,000 --> 00:15:18,000
743
+ Additionally, if you scroll down a bit, you can also find examples of SQL queries.
744
+
745
+ 187
746
+ 00:15:19,000 --> 00:15:24,000
747
+ You can create your own queries from database and your application by analogy.
748
+
749
+ 188
750
+ 00:15:25,000 --> 00:15:29,000
751
+ And at the meantime, let's proceed with another examples.
752
+
753
+ 189
754
+ 00:15:30,000 --> 00:15:37,000
755
+ Let's learn now such important statements as all the statements we use, all the statements when we
756
+
757
+ 190
758
+ 00:15:37,000 --> 00:15:44,000
759
+ need to update the database object, no matter whether we need to update the database or table, we
760
+
761
+ 191
762
+ 00:15:44,000 --> 00:15:50,000
763
+ are going to start query with all the keywords as you already know how to use the commendation.
764
+
765
+ 192
766
+ 00:15:50,000 --> 00:15:55,000
767
+ I don't see a lot of reasons to go over each alter statement.
768
+
769
+ 193
770
+ 00:15:55,000 --> 00:15:57,000
771
+ I mean, I will not damage you now.
772
+
773
+ 194
774
+ 00:15:57,000 --> 00:16:04,000
775
+ All possible variations of all of the statements that includes and in columns and column properties
776
+
777
+ 195
778
+ 00:16:04,000 --> 00:16:08,000
779
+ change enough charset and collation and lots more.
780
+
781
+ 196
782
+ 00:16:08,000 --> 00:16:12,000
783
+ For the sake of the Namma, I will demo only one case was also in table.
784
+
785
+ 197
786
+ 00:16:12,000 --> 00:16:18,000
787
+ In order you could understand how it works, let's adjust this table.
788
+
789
+ 198
790
+ 00:16:18,000 --> 00:16:26,000
791
+ We are going to add new column after the first name and adjust first name index to change ordering in
792
+
793
+ 199
794
+ 00:16:26,000 --> 00:16:28,000
795
+ there from ascending the descending.
796
+
797
+ 200
798
+ 00:16:29,000 --> 00:16:37,000
799
+ I write alter table and after that I specifies a full table name, and after that I put instructions
800
+
801
+ 201
802
+ 00:16:37,000 --> 00:16:47,000
803
+ related to my table of the I want to add column was name plus name was version, data type and default.
804
+
805
+ 202
806
+ 00:16:47,000 --> 00:16:56,000
807
+ No value after first name column to accommodate index, I need to drop existing index first and after
808
+
809
+ 203
810
+ 00:16:56,000 --> 00:16:58,000
811
+ that to add new index was descending.
812
+
813
+ 204
814
+ 00:16:58,000 --> 00:17:02,000
815
+ Order Drop Command Remove Index.
816
+
817
+ 205
818
+ 00:17:03,000 --> 00:17:07,000
819
+ Let me execute this query query is successfully executed.
820
+
821
+ 206
822
+ 00:17:08,000 --> 00:17:11,000
823
+ Let's open table now and here is our new column.
824
+
825
+ 207
826
+ 00:17:12,000 --> 00:17:14,000
827
+ We can also check our index.
828
+
829
+ 208
830
+ 00:17:15,000 --> 00:17:19,000
831
+ We can see that we have to send an order in our index.
832
+
833
+ 209
834
+ 00:17:19,000 --> 00:17:23,000
835
+ Basically, that's all what I wanted to share with you regarding all the query.
836
+
837
+ 210
838
+ 00:17:24,000 --> 00:17:29,000
839
+ You can rename table using separate statement from data definition language.
840
+
841
+ 211
842
+ 00:17:29,000 --> 00:17:30,000
843
+ It is called Renee.
844
+
845
+ 212
846
+ 00:17:31,000 --> 00:17:35,000
847
+ We can easily rename our table to test DB.
848
+
849
+ 213
850
+ 00:17:36,000 --> 00:17:40,000
851
+ And after refresh, we seize a table name has been changed.
852
+
853
+ 214
854
+ 00:17:41,000 --> 00:17:47,000
855
+ One more interesting statement truncate we can create statements that will empty all table.
856
+
857
+ 215
858
+ 00:17:48,000 --> 00:17:54,000
859
+ You to add some fake data in it first, for example, let me add just one row in this table.
860
+
861
+ 216
862
+ 00:17:55,000 --> 00:17:56,000
863
+ Give me a few seconds.
864
+
865
+ 217
866
+ 00:18:07,000 --> 00:18:15,000
867
+ As you see, now, we have some data in the table, and when I try to extract all the rows from table
868
+
869
+ 218
870
+ 00:18:15,000 --> 00:18:19,000
871
+ one more time, I see that my role is in place.
872
+
873
+ 219
874
+ 00:18:20,000 --> 00:18:27,000
875
+ If you're interested how to perform such basic operations as data insertion inside workbench, please
876
+
877
+ 220
878
+ 00:18:27,000 --> 00:18:30,000
879
+ refer to lesson about my skill workbench.
880
+
881
+ 221
882
+ 00:18:31,000 --> 00:18:33,000
883
+ Now we can execute the following statement.
884
+
885
+ 222
886
+ 00:18:34,000 --> 00:18:36,000
887
+ TRUNCATE test to.
888
+
889
+ 223
890
+ 00:18:37,000 --> 00:18:39,000
891
+ It should remove all rows in table.
892
+
893
+ 224
894
+ 00:18:40,000 --> 00:18:43,000
895
+ And you can see that all rows have been removed.
896
+
897
+ 225
898
+ 00:18:44,000 --> 00:18:45,000
899
+ Let's move on.
900
+
901
+ 226
902
+ 00:18:46,000 --> 00:18:53,000
903
+ And the last, but not the listing for today that I'd like to show you is drop statements, we use drop
904
+
905
+ 227
906
+ 00:18:53,000 --> 00:18:56,000
907
+ statement when we need to remove database object.
908
+
909
+ 228
910
+ 00:18:56,000 --> 00:19:02,000
911
+ For example, if you want to remove a table or database, you have to use drop statement.
912
+
913
+ 229
914
+ 00:19:02,000 --> 00:19:05,000
915
+ Let's review example of the nation of our database.
916
+
917
+ 230
918
+ 00:19:06,000 --> 00:19:13,000
919
+ The database we have to execute the following query drop database and database name.
920
+
921
+ 231
922
+ 00:19:13,000 --> 00:19:17,000
923
+ Everything is simple according to documentation you can add.
924
+
925
+ 232
926
+ 00:19:17,000 --> 00:19:22,000
927
+ If exists, check a database only if it is present.
928
+
929
+ 233
930
+ 00:19:23,000 --> 00:19:24,000
931
+ That's all for this lesson.
932
+
933
+ 234
934
+ 00:19:25,000 --> 00:19:27,000
935
+ Let's recap what we have learned today.
936
+
937
+ 235
938
+ 00:19:28,000 --> 00:19:31,000
939
+ We have learned a lot of different sinks in this lesson.
940
+
941
+ 236
942
+ 00:19:31,000 --> 00:19:33,000
943
+ Some of them are now.
944
+
945
+ 237
946
+ 00:19:33,000 --> 00:19:36,000
947
+ You know what sequel is after this lesson?
948
+
949
+ 238
950
+ 00:19:36,000 --> 00:19:38,000
951
+ You know, sequels, some languages.
952
+
953
+ 239
954
+ 00:19:38,000 --> 00:19:47,000
955
+ Zaire did the al DML DCL and to see out on real examples, we learned create statements.
956
+
957
+ 240
958
+ 00:19:48,000 --> 00:19:55,000
959
+ Also, I explained all to rename, truncate and drop statements after this lesson, you know how to
960
+
961
+ 241
962
+ 00:19:55,000 --> 00:19:57,000
963
+ build queries with mansion statements.
964
+
965
+ 242
966
+ 00:19:58,000 --> 00:20:00,000
967
+ That's all for this lesson.
968
+
969
+ 243
970
+ 00:20:00,000 --> 00:20:02,000
971
+ Thanks you all for your attention.
972
+
973
+ 244
974
+ 00:20:02,000 --> 00:20:05,000
975
+ Have a great day and see you in the next lesson.
976
+
48 - SQL/002 INSERT-statement-documentation.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://dev.mysql.com/doc/refman/8.0/en/insert.html
48 - SQL/002 Query-Examples-that-were-shown-in-the-lesson.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/sql_queries/dml
48 - SQL/002 SQL DML - CRUD Operations (SELECT, INSERT, UPDATE, DELETE)_en.srt ADDED
@@ -0,0 +1,1380 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:05,000 --> 00:00:06,000
3
+ Hello, Tim.
4
+
5
+ 2
6
+ 00:00:06,000 --> 00:00:12,000
7
+ Today we're going to learn data manipulation language will learn main statements from Male Group of
8
+
9
+ 3
10
+ 00:00:12,000 --> 00:00:13,000
11
+ Sequel.
12
+
13
+ 4
14
+ 00:00:13,000 --> 00:00:19,000
15
+ And will review real examples to help you understand how you can apply this knowledge on practice.
16
+
17
+ 5
18
+ 00:00:20,000 --> 00:00:27,000
19
+ We'll start our lesson from understanding of select statements will spend a significant amount of power,
20
+
21
+ 6
22
+ 00:00:27,000 --> 00:00:34,000
23
+ our lesson learned select statement considering that this is probably the most popular statement that
24
+
25
+ 7
26
+ 00:00:34,000 --> 00:00:42,000
27
+ you are going to use it as different variations and options that I believe you should know that includes
28
+
29
+ 8
30
+ 00:00:42,000 --> 00:00:44,000
31
+ order by were close.
32
+
33
+ 9
34
+ 00:00:44,000 --> 00:00:48,000
35
+ Distinct search by pardon, et cetera.
36
+
37
+ 10
38
+ 00:00:48,000 --> 00:00:54,000
39
+ I'm going to explain you different operators and sequels that you can use in your queries.
40
+
41
+ 11
42
+ 00:00:55,000 --> 00:00:59,000
43
+ We'll review aggregate functions that are often used with select statements.
44
+
45
+ 12
46
+ 00:01:00,000 --> 00:01:06,000
47
+ You're going to learn how to group result of select statement and apply condition on it.
48
+
49
+ 13
50
+ 00:01:06,000 --> 00:01:12,000
51
+ And also, we're going to learn and review aussi important statements from your e-mail.
52
+
53
+ 14
54
+ 00:01:12,000 --> 00:01:17,000
55
+ You'll see examples was insert, update and delete statements.
56
+
57
+ 15
58
+ 00:01:17,000 --> 00:01:19,000
59
+ Let's start our lesson.
60
+
61
+ 16
62
+ 00:01:20,000 --> 00:01:28,000
63
+ During your career as an engineer, you're going to hear very often such acronyms as crap it stands
64
+
65
+ 17
66
+ 00:01:28,000 --> 00:01:37,000
67
+ for create, read, update, delete in computer programming crowd operations as a full basic operations
68
+
69
+ 18
70
+ 00:01:37,000 --> 00:01:38,000
71
+ of persistent storage.
72
+
73
+ 19
74
+ 00:01:39,000 --> 00:01:48,000
75
+ Craft is also sometimes used to describe user interface conventions that facilitate viewing, searching
76
+
77
+ 20
78
+ 00:01:48,000 --> 00:01:54,000
79
+ and changing information using computer based forms and reports data manipulation.
80
+
81
+ 21
82
+ 00:01:54,000 --> 00:02:02,000
83
+ Language describes syntax that will allow you to perform crud operations on the database layer, basically
84
+
85
+ 22
86
+ 00:02:03,000 --> 00:02:10,000
87
+ to create, or, in other words, to insert rows in tables to read data from database or, in other
88
+
89
+ 23
90
+ 00:02:10,000 --> 00:02:18,000
91
+ words, to select roles that match conditions to update throws and to delete rows that you don't need
92
+
93
+ 24
94
+ 00:02:18,000 --> 00:02:19,000
95
+ anymore.
96
+
97
+ 25
98
+ 00:02:19,000 --> 00:02:24,000
99
+ And the first statement that I'd like to review with you today is select statement.
100
+
101
+ 26
102
+ 00:02:25,000 --> 00:02:29,000
103
+ This is a really important statement that I believe you are going to use very often.
104
+
105
+ 27
106
+ 00:02:29,000 --> 00:02:34,000
107
+ That's why I would like to review different variations of the statement on the slide.
108
+
109
+ 28
110
+ 00:02:34,000 --> 00:02:38,000
111
+ You can see how select statement is described in my sequel.
112
+
113
+ 29
114
+ 00:02:38,000 --> 00:02:39,000
115
+ Official documentation.
116
+
117
+ 30
118
+ 00:02:40,000 --> 00:02:44,000
119
+ As you can see, it contains really a lot of different variations.
120
+
121
+ 31
122
+ 00:02:45,000 --> 00:02:47,000
123
+ Some of them, we are going to learn in this lesson.
124
+
125
+ 32
126
+ 00:02:48,000 --> 00:02:50,000
127
+ Some of them will keep learning and other lessons.
128
+
129
+ 33
130
+ 00:02:51,000 --> 00:02:54,000
131
+ Let me show you a simplified version of Select Statement.
132
+
133
+ 34
134
+ 00:02:55,000 --> 00:02:59,000
135
+ On this slide, you see a simplified version of select statements.
136
+
137
+ 35
138
+ 00:02:59,000 --> 00:03:01,000
139
+ Let's learn it for now.
140
+
141
+ 36
142
+ 00:03:01,000 --> 00:03:04,000
143
+ And we are going to learn even more in practice.
144
+
145
+ 37
146
+ 00:03:05,000 --> 00:03:10,000
147
+ You can write select, followed by asterisk from and specify table name.
148
+
149
+ 38
150
+ 00:03:11,000 --> 00:03:14,000
151
+ Asterisk stands for all attributes.
152
+
153
+ 39
154
+ 00:03:14,000 --> 00:03:20,000
155
+ This is like mask that is used to extract all attributes of selected tuple.
156
+
157
+ 40
158
+ 00:03:21,000 --> 00:03:25,000
159
+ Next things you can see on this slide is example of search and query.
160
+
161
+ 41
162
+ 00:03:26,000 --> 00:03:32,000
163
+ It is worth to say that searching on the database side is plus, rather than extracting onslaught of
164
+
165
+ 42
166
+ 00:03:32,000 --> 00:03:35,000
167
+ data and sources in memory of the app.
168
+
169
+ 43
170
+ 00:03:36,000 --> 00:03:43,000
171
+ That's why sometimes this query might come in handy, especially when you want to implement pagination.
172
+
173
+ 44
174
+ 00:03:43,000 --> 00:03:51,000
175
+ A little bit later, we're going to talk about pagination, so to search items and database site, you
176
+
177
+ 45
178
+ 00:03:51,000 --> 00:03:55,000
179
+ still use the same select statement, but you have to add order.
180
+
181
+ 46
182
+ 00:03:55,000 --> 00:04:01,000
183
+ By the end of the query, you should specify column that you are going to use for searching.
184
+
185
+ 47
186
+ 00:04:02,000 --> 00:04:05,000
187
+ By default, searching is in ascending order.
188
+
189
+ 48
190
+ 00:04:06,000 --> 00:04:12,000
191
+ That's why usually you may need sorting order option if you are good with default sorting.
192
+
193
+ 49
194
+ 00:04:13,000 --> 00:04:20,000
195
+ But if you want rows to be sorted in descending order, you have to specify this vividly.
196
+
197
+ 50
198
+ 00:04:20,000 --> 00:04:25,000
199
+ You can source all the rows by two or more columns if needed.
200
+
201
+ 51
202
+ 00:04:26,000 --> 00:04:31,000
203
+ Just list columns that you want to use for certain separate by comma.
204
+
205
+ 52
206
+ 00:04:31,000 --> 00:04:38,000
207
+ Like in the example on the slide, you want to search all the rows by field one in descending order
208
+
209
+ 53
210
+ 00:04:39,000 --> 00:04:41,000
211
+ and by field two in ascending order.
212
+
213
+ 54
214
+ 00:04:42,000 --> 00:04:50,000
215
+ Besides selecting all roles with all fields, you can be more specific, for example, after select
216
+
217
+ 55
218
+ 00:04:50,000 --> 00:04:54,000
219
+ keywords, you can least fields that you want to extract.
220
+
221
+ 56
222
+ 00:04:55,000 --> 00:04:59,000
223
+ Also, you can put them close and specify select conditions.
224
+
225
+ 57
226
+ 00:05:00,000 --> 00:05:08,000
227
+ In this case, we need to select all roles where field one has to be less than 10, and Field two has
228
+
229
+ 58
230
+ 00:05:08,000 --> 00:05:17,000
231
+ to be equal to X and believe you are smart enough to understand the type of data query should match
232
+
233
+ 59
234
+ 00:05:17,000 --> 00:05:18,000
235
+ was data type of the column.
236
+
237
+ 60
238
+ 00:05:19,000 --> 00:05:22,000
239
+ You can use logical conjunction keywords.
240
+
241
+ 61
242
+ 00:05:23,000 --> 00:05:29,000
243
+ You can use IZA and or or keywords when you use and do.
244
+
245
+ 62
246
+ 00:05:29,000 --> 00:05:38,000
247
+ Conditions will be very in each Stacpoole and only zone is that much of these conditions will be returned.
248
+
249
+ 63
250
+ 00:05:38,000 --> 00:05:47,000
251
+ If you use or that means that in case at least one of these conditions is Matt will return zero.
252
+
253
+ 64
254
+ 00:05:47,000 --> 00:05:55,000
255
+ These are not the only logical operators a little bit later today in the lesson we are going to review
256
+
257
+ 65
258
+ 00:05:55,000 --> 00:05:57,000
259
+ other operators too.
260
+
261
+ 66
262
+ 00:05:57,000 --> 00:06:05,000
263
+ But I would say that most of the times you would use either and or or use every single year so far.
264
+
265
+ 67
266
+ 00:06:06,000 --> 00:06:12,000
267
+ Remember that even in case you have any questions, you can always write them in the comments to this
268
+
269
+ 68
270
+ 00:06:12,000 --> 00:06:13,000
271
+ video.
272
+
273
+ 69
274
+ 00:06:14,000 --> 00:06:20,000
275
+ And if this small piece of theory is clear for you, that means we are going to proceed with real examples
276
+
277
+ 70
278
+ 00:06:20,000 --> 00:06:23,000
279
+ and learning of you select statements.
280
+
281
+ 71
282
+ 00:06:24,000 --> 00:06:28,000
283
+ Now let's execute these statements against data in database.
284
+
285
+ 72
286
+ 00:06:29,000 --> 00:06:34,000
287
+ And as usual, I'm going to save all queries that will be used in this lesson.
288
+
289
+ 73
290
+ 00:06:34,000 --> 00:06:38,000
291
+ And you will find them in attachments to the lesson.
292
+
293
+ 74
294
+ 00:06:38,000 --> 00:06:45,000
295
+ Having the same queries will allow you to run the same queries on your own computer to understand as
296
+
297
+ 75
298
+ 00:06:45,000 --> 00:06:46,000
299
+ a topic better.
300
+
301
+ 76
302
+ 00:06:47,000 --> 00:06:52,000
303
+ Before we start execute queries, make sure that your previous lessons.
304
+
305
+ 77
306
+ 00:06:52,000 --> 00:06:56,000
307
+ You also created user, themore the same as I did.
308
+
309
+ 78
310
+ 00:06:56,000 --> 00:07:00,000
311
+ Also pay attention that we already pasted some information here.
312
+
313
+ 79
314
+ 00:07:01,000 --> 00:07:09,000
315
+ I just changed the names and emails here to make it look more realistic because to be able to see how
316
+
317
+ 80
318
+ 00:07:09,000 --> 00:07:13,000
319
+ select statements work, you have to have some data first.
320
+
321
+ 81
322
+ 00:07:13,000 --> 00:07:20,000
323
+ So as you can see, the simplest query is to select all couples from user table, and it looks like
324
+
325
+ 82
326
+ 00:07:20,000 --> 00:07:23,000
327
+ this nice and special and great.
328
+
329
+ 83
330
+ 00:07:24,000 --> 00:07:32,000
331
+ If you want to extract on the specific fields, you should list them instead of asterisk, like I did
332
+
333
+ 84
334
+ 00:07:32,000 --> 00:07:34,000
335
+ here in this particular example.
336
+
337
+ 85
338
+ 00:07:34,000 --> 00:07:38,000
339
+ I want to extract on the first name and last name.
340
+
341
+ 86
342
+ 00:07:38,000 --> 00:07:43,000
343
+ Let's sort now fills my last name in descending order.
344
+
345
+ 87
346
+ 00:07:43,000 --> 00:07:47,000
347
+ And after that, my first name in descending order.
348
+
349
+ 88
350
+ 00:07:48,000 --> 00:07:52,000
351
+ That is needed because we already have a few rows with the same last name.
352
+
353
+ 89
354
+ 00:07:53,000 --> 00:07:57,000
355
+ Thus, searching only by last name won't be enough.
356
+
357
+ 90
358
+ 00:07:58,000 --> 00:08:02,000
359
+ And we have to come up with additional rule for sorting.
360
+
361
+ 91
362
+ 00:08:02,000 --> 00:08:08,000
363
+ I add order by keywords and specify columns that I want to use for sorting.
364
+
365
+ 92
366
+ 00:08:09,000 --> 00:08:10,000
367
+ Let's execute this query.
368
+
369
+ 93
370
+ 00:08:11,000 --> 00:08:18,000
371
+ Now, let's add condition I'd like to extract all rows where a last name is equal to Ivanov.
372
+
373
+ 94
374
+ 00:08:19,000 --> 00:08:22,000
375
+ I write very close and specify condition.
376
+
377
+ 95
378
+ 00:08:23,000 --> 00:08:29,000
379
+ And after we executed queries, we received only rows that meets our condition.
380
+
381
+ 96
382
+ 00:08:29,000 --> 00:08:34,000
383
+ Regarding operators in my school, you can use different operators.
384
+
385
+ 97
386
+ 00:08:35,000 --> 00:08:42,000
387
+ As I said, let's discuss operators as a separate topic and little bit later today, but ensured talking
388
+
389
+ 98
390
+ 00:08:42,000 --> 00:08:44,000
391
+ about comparative operators.
392
+
393
+ 99
394
+ 00:08:44,000 --> 00:08:53,000
395
+ NASA's special you can use more or less more or equal to less or equal to not equal to operators here
396
+
397
+ 100
398
+ 00:08:53,000 --> 00:08:53,000
399
+ in condition.
400
+
401
+ 101
402
+ 00:08:54,000 --> 00:09:02,000
403
+ One more important scene to show you is this certain keywords, for example, you need to extract all
404
+
405
+ 102
406
+ 00:09:02,000 --> 00:09:07,000
407
+ different last names or names from the table without any duplicates.
408
+
409
+ 103
410
+ 00:09:07,000 --> 00:09:12,000
411
+ You can use distinct keywords in the attribute to receive all the different values.
412
+
413
+ 104
414
+ 00:09:13,000 --> 00:09:19,000
415
+ Like in this example, when we executed the query, we don't receive any duplicated last names.
416
+
417
+ 105
418
+ 00:09:19,000 --> 00:09:20,000
419
+ Does it make sense?
420
+
421
+ 106
422
+ 00:09:21,000 --> 00:09:28,000
423
+ Now, let's imagine that you forgot what you are looking for and you don't remember the search parameter.
424
+
425
+ 107
426
+ 00:09:29,000 --> 00:09:33,000
427
+ But you remember that last name of the user you started from if.
428
+
429
+ 108
430
+ 00:09:34,000 --> 00:09:36,000
431
+ How to find what you need.
432
+
433
+ 109
434
+ 00:09:36,000 --> 00:09:40,000
435
+ You can search by specified pattern was like.
436
+
437
+ 110
438
+ 00:09:40,000 --> 00:09:41,000
439
+ Operator.
440
+
441
+ 111
442
+ 00:09:41,000 --> 00:09:48,000
443
+ The operator is used in a where close to search for a specified partner in the column.
444
+
445
+ 112
446
+ 00:09:49,000 --> 00:09:55,000
447
+ There are two wild cards often used in conjunction with like operator Z.
448
+
449
+ 113
450
+ 00:09:55,000 --> 00:09:59,000
451
+ Person Sign represents zero one or multiple characters.
452
+
453
+ 114
454
+ 00:09:59,000 --> 00:10:08,000
455
+ The underscore sign represents one single character in our specific case one we want to find all rows
456
+
457
+ 115
458
+ 00:10:08,000 --> 00:10:14,000
459
+ where our last name is started was safe and we don't know the full last name.
460
+
461
+ 116
462
+ 00:10:14,000 --> 00:10:16,000
463
+ We need to use person sign.
464
+
465
+ 117
466
+ 00:10:17,000 --> 00:10:25,000
467
+ Look at this query by this and telling us that after if there might be a different number of characters,
468
+
469
+ 118
470
+ 00:10:25,000 --> 00:10:28,000
471
+ let's execute this first query.
472
+
473
+ 119
474
+ 00:10:28,000 --> 00:10:34,000
475
+ And you can see that I have to tap those returns in as a query.
476
+
477
+ 120
478
+ 00:10:34,000 --> 00:10:39,000
479
+ I am saying that zero is one character that is followed by me.
480
+
481
+ 121
482
+ 00:10:39,000 --> 00:10:45,000
483
+ And after that, we have a different amount of characters, and I don't know how much.
484
+
485
+ 122
486
+ 00:10:45,000 --> 00:10:48,000
487
+ Exactly opposite is it clear?
488
+
489
+ 123
490
+ 00:10:49,000 --> 00:10:56,000
491
+ That's not what education nation is and what we need to know to support pagination on the database level,
492
+
493
+ 124
494
+ 00:10:57,000 --> 00:11:05,000
495
+ pagination is a matter of divided content into discrete pages, thus presenting content in a limited
496
+
497
+ 125
498
+ 00:11:06,000 --> 00:11:07,000
499
+ and digestible manner.
500
+
501
+ 126
502
+ 00:11:08,000 --> 00:11:16,000
503
+ We will search result page is a typical example of such a search if you downloaded applications that
504
+
505
+ 127
506
+ 00:11:16,000 --> 00:11:19,000
507
+ I created for my students, for mobile phones.
508
+
509
+ 128
510
+ 00:11:19,000 --> 00:11:20,000
511
+ Learn it.
512
+
513
+ 129
514
+ 00:11:20,000 --> 00:11:24,000
515
+ You can find the example of pagination in the history.
516
+
517
+ 130
518
+ 00:11:25,000 --> 00:11:33,000
519
+ If you have a lot of tests and certifications passed and you open history inside the app to explore
520
+
521
+ 131
522
+ 00:11:33,000 --> 00:11:41,000
523
+ your previous results, you can scroll test results, but not all test results extracted from the database
524
+
525
+ 132
526
+ 00:11:41,000 --> 00:11:42,000
527
+ at once.
528
+
529
+ 133
530
+ 00:11:43,000 --> 00:11:47,000
531
+ They are loaded in chunks after you scrolled to the lowest record.
532
+
533
+ 134
534
+ 00:11:48,000 --> 00:11:51,000
535
+ I extracted records from a database by small chunks.
536
+
537
+ 135
538
+ 00:11:52,000 --> 00:11:59,000
539
+ Instead of extracting all of the latest records at once during the stand, imagine that you have 100
540
+
541
+ 136
542
+ 00:11:59,000 --> 00:12:05,000
543
+ or even 1000 test results, but you need to check on the few last ones.
544
+
545
+ 137
546
+ 00:12:05,000 --> 00:12:13,000
547
+ In this case, is any sense to extract all rows and pass them from the server into the mobile app.
548
+
549
+ 138
550
+ 00:12:14,000 --> 00:12:15,000
551
+ Definitely not.
552
+
553
+ 139
554
+ 00:12:15,000 --> 00:12:23,000
555
+ That's why you're in the design of our app before we see that we need pagination support here and to
556
+
557
+ 140
558
+ 00:12:23,000 --> 00:12:26,000
559
+ be even more specific in mobile apps.
560
+
561
+ 141
562
+ 00:12:26,000 --> 00:12:33,000
563
+ This is called Infinite's crawl, and this allows you to scroll content down without any interruption.
564
+
565
+ 142
566
+ 00:12:34,000 --> 00:12:40,000
567
+ Infinite scrolling is a functionality allowing users to scroll down a massive amount of information,
568
+
569
+ 143
570
+ 00:12:41,000 --> 00:12:48,000
571
+ presenting it in easy to consume chunks and data is uploaded as you reached the lowest records on the
572
+
573
+ 144
574
+ 00:12:48,000 --> 00:12:49,000
575
+ screen.
576
+
577
+ 145
578
+ 00:12:49,000 --> 00:12:55,000
579
+ I'm sure you're faced with such design while using other apps in database.
580
+
581
+ 146
582
+ 00:12:55,000 --> 00:12:59,000
583
+ We can support pagination by extracting specified range of records.
584
+
585
+ 147
586
+ 00:12:59,000 --> 00:13:06,000
587
+ With the help of limit operator, the cycle limit close restricts how many rows are returned from a
588
+
589
+ 148
590
+ 00:13:06,000 --> 00:13:07,000
591
+ query.
592
+
593
+ 149
594
+ 00:13:07,000 --> 00:13:14,000
595
+ The syntax for the limit close represents how many requests you want to retrieve and starting from which
596
+
597
+ 150
598
+ 00:13:14,000 --> 00:13:22,000
599
+ record, for example, you can use is a limit close to retrieves a top five users by number of coins.
600
+
601
+ 151
602
+ 00:13:23,000 --> 00:13:30,000
603
+ Or you could extract the user starting from the six position to tance sorted by number of coins.
604
+
605
+ 152
606
+ 00:13:31,000 --> 00:13:36,000
607
+ Zeleny The class is only compatible with the sequel select statement.
608
+
609
+ 153
610
+ 00:13:36,000 --> 00:13:40,000
611
+ You can use a limit class in SQL Update statement.
612
+
613
+ 154
614
+ 00:13:40,000 --> 00:13:44,000
615
+ For instance, your limit number must be positive.
616
+
617
+ 155
618
+ 00:13:45,000 --> 00:13:48,000
619
+ Say you want to retrieve records from the bottom of the list.
620
+
621
+ 156
622
+ 00:13:49,000 --> 00:13:54,000
623
+ You should use a sequel or buy statement to order them in descending order.
624
+
625
+ 157
626
+ 00:13:55,000 --> 00:13:57,000
627
+ Then you should use any misstatement.
628
+
629
+ 158
630
+ 00:13:58,000 --> 00:14:01,000
631
+ Let's learn how to work with limited statement on practice.
632
+
633
+ 159
634
+ 00:14:02,000 --> 00:14:03,000
635
+ We have three requests here.
636
+
637
+ 160
638
+ 00:14:04,000 --> 00:14:09,000
639
+ Let me extract two users sorted by email in ascending order.
640
+
641
+ 161
642
+ 00:14:09,000 --> 00:14:13,000
643
+ I write Select all from user order by email.
644
+
645
+ 162
646
+ 00:14:14,000 --> 00:14:22,000
647
+ Limit to the last four limit two means that it would return me to records only.
648
+
649
+ 163
650
+ 00:14:22,000 --> 00:14:27,000
651
+ Let's execute this query, and you can see that where was these?
652
+
653
+ 164
654
+ 00:14:27,000 --> 00:14:30,000
655
+ Three and four have been returned.
656
+
657
+ 165
658
+ 00:14:31,000 --> 00:14:35,000
659
+ But as we have already discussed, we can specify offset.
660
+
661
+ 166
662
+ 00:14:35,000 --> 00:14:37,000
663
+ We add additional parameter.
664
+
665
+ 167
666
+ 00:14:37,000 --> 00:14:46,000
667
+ In the second example, offset is one, so we are skipping the first one returned and will return to
668
+
669
+ 168
670
+ 00:14:46,000 --> 00:14:48,000
671
+ records after the first one.
672
+
673
+ 169
674
+ 00:14:48,000 --> 00:14:49,000
675
+ Does it make sense?
676
+
677
+ 170
678
+ 00:14:50,000 --> 00:14:55,000
679
+ So we return to records after keeping the first records?
680
+
681
+ 171
682
+ 00:14:55,000 --> 00:14:59,000
683
+ Basically from the second position of our ordering.
684
+
685
+ 172
686
+ 00:15:00,000 --> 00:15:07,000
687
+ And now when we execute this query, we have records with I.D. four and one return.
688
+
689
+ 173
690
+ 00:15:07,000 --> 00:15:15,000
691
+ Is it clear for you why this is happening and when you implement queries for your app, you can build
692
+
693
+ 174
694
+ 00:15:15,000 --> 00:15:16,000
695
+ them accordingly.
696
+
697
+ 175
698
+ 00:15:16,000 --> 00:15:23,000
699
+ For example, you can post as a server parameters of pages that you want to retrieve and the number
700
+
701
+ 176
702
+ 00:15:23,000 --> 00:15:26,000
703
+ of trackers and paste them into the query.
704
+
705
+ 177
706
+ 00:15:27,000 --> 00:15:29,000
707
+ Anyways, this is not a topic of this lesson.
708
+
709
+ 178
710
+ 00:15:29,000 --> 00:15:34,000
711
+ It is just a hint we'll learn how to implement this one.
712
+
713
+ 179
714
+ 00:15:34,000 --> 00:15:38,000
715
+ We'll start learning of that application development as of now.
716
+
717
+ 180
718
+ 00:15:39,000 --> 00:15:43,000
719
+ I want you to know and remember how to work with that statement.
720
+
721
+ 181
722
+ 00:15:44,000 --> 00:15:51,000
723
+ The next thing that I'd like to amuse you is Quarians, and no attributes, just a smile or see them
724
+
725
+ 182
726
+ 00:15:51,000 --> 00:15:59,000
727
+ then, but still very important, and a lot of my students do the same mistake when they just start
728
+
729
+ 183
730
+ 00:15:59,000 --> 00:16:00,000
731
+ to use in school.
732
+
733
+ 184
734
+ 00:16:00,000 --> 00:16:08,000
735
+ If you want to select couples that have no value in some of the attributes, you can just use equal
736
+
737
+ 185
738
+ 00:16:08,000 --> 00:16:09,000
739
+ operator.
740
+
741
+ 186
742
+ 00:16:10,000 --> 00:16:16,000
743
+ Let me show you if you want to select users is that's no value in the f k user all field.
744
+
745
+ 187
746
+ 00:16:17,000 --> 00:16:24,000
747
+ You can't just use equal operator because it won't give you results that you expect.
748
+
749
+ 188
750
+ 00:16:24,000 --> 00:16:31,000
751
+ Instead, you have to use another keyword you have to use is now or is not now.
752
+
753
+ 189
754
+ 00:16:31,000 --> 00:16:34,000
755
+ This is a specific that you should be aware of.
756
+
757
+ 190
758
+ 00:16:35,000 --> 00:16:37,000
759
+ So please don't forget about this.
760
+
761
+ 191
762
+ 00:16:38,000 --> 00:16:44,000
763
+ We already removed a few examples, and I believe you understand how to work with select statements,
764
+
765
+ 192
766
+ 00:16:44,000 --> 00:16:49,000
767
+ but still and those are things that we need to learn is different operators.
768
+
769
+ 193
770
+ 00:16:49,000 --> 00:16:53,000
771
+ Definitely, there is no sense to hold them off.
772
+
773
+ 194
774
+ 00:16:53,000 --> 00:16:58,000
775
+ Select statements on real data was each possible operator instead.
776
+
777
+ 195
778
+ 00:16:58,000 --> 00:17:02,000
779
+ Problem is, there is a sense to learn different operators now.
780
+
781
+ 196
782
+ 00:17:02,000 --> 00:17:06,000
783
+ I will also provide you with examples of how to apply different.
784
+
785
+ 197
786
+ 00:17:06,000 --> 00:17:12,000
787
+ Operator Let's start from the first group of operators in sequel arithmetic operators.
788
+
789
+ 198
790
+ 00:17:13,000 --> 00:17:20,000
791
+ Basically, there is nothing special and no signs that you didn't learn in elementary school.
792
+
793
+ 199
794
+ 00:17:20,000 --> 00:17:24,000
795
+ The only exclusion is modular operator problem.
796
+
797
+ 200
798
+ 00:17:24,000 --> 00:17:30,000
799
+ But if you are familiar with one of the most popular programming languages, you already knows that
800
+
801
+ 201
802
+ 00:17:30,000 --> 00:17:35,000
803
+ usually person sign is used for operations to extract reminder after division.
804
+
805
+ 202
806
+ 00:17:36,000 --> 00:17:40,000
807
+ If you need a few more seconds to review examples, please.
808
+
809
+ 203
810
+ 00:17:40,000 --> 00:17:41,000
811
+ Grasset boss.
812
+
813
+ 204
814
+ 00:17:42,000 --> 00:17:43,000
815
+ Let's continue.
816
+
817
+ 205
818
+ 00:17:43,000 --> 00:17:49,000
819
+ Well, that was a group of operators that we are going to review its comparison operators.
820
+
821
+ 206
822
+ 00:17:49,000 --> 00:17:57,000
823
+ Most of them are also familiar to you, probably not equal to operator may look like and you one for
824
+
825
+ 207
826
+ 00:17:57,000 --> 00:17:58,000
827
+ some students.
828
+
829
+ 208
830
+ 00:17:59,000 --> 00:18:07,000
831
+ Basically, the general rule is not equal to operator is written like this, but also in some relational
832
+
833
+ 209
834
+ 00:18:07,000 --> 00:18:08,000
835
+ database management systems.
836
+
837
+ 210
838
+ 00:18:08,000 --> 00:18:15,000
839
+ It is also possible to use another syntax of note equal to operator that is more similar to one that
840
+
841
+ 211
842
+ 00:18:15,000 --> 00:18:17,000
843
+ we use in programming languages.
844
+
845
+ 212
846
+ 00:18:18,000 --> 00:18:25,000
847
+ And on this slide, you can find logical operators will read your review to such logical operators as
848
+
849
+ 213
850
+ 00:18:25,000 --> 00:18:27,000
851
+ and or lie.
852
+
853
+ 214
854
+ 00:18:28,000 --> 00:18:38,000
855
+ But as you can see, some of them look through the table on this slide, grasp if needed, and ask questions
856
+
857
+ 215
858
+ 00:18:38,000 --> 00:18:42,000
859
+ in comments to the video in case someone is still not clear here.
860
+
861
+ 216
862
+ 00:18:43,000 --> 00:18:50,000
863
+ Now, let's learn aggregate functions again, then we'll use them with select statements.
864
+
865
+ 217
866
+ 00:18:50,000 --> 00:18:57,000
867
+ That's why I believe it is better to use them in conjunction with select statements and aggregate function,
868
+
869
+ 218
870
+ 00:18:57,000 --> 00:19:06,000
871
+ performs a calculation on a set of values and returns a single value except for count aggregate functions.
872
+
873
+ 219
874
+ 00:19:06,000 --> 00:19:08,000
875
+ Ignore null values.
876
+
877
+ 220
878
+ 00:19:08,000 --> 00:19:15,000
879
+ Aggregate functions are often used with the group by close of the select statement, and here in the
880
+
881
+ 221
882
+ 00:19:15,000 --> 00:19:22,000
883
+ slide, you can see product table examples that I'm going to use for the explanation of the following
884
+
885
+ 222
886
+ 00:19:22,000 --> 00:19:23,000
887
+ aggregate functions.
888
+
889
+ 223
890
+ 00:19:24,000 --> 00:19:26,000
891
+ Let's start from the learned man and the.
892
+
893
+ 224
894
+ 00:19:27,000 --> 00:19:32,000
895
+ Based on the name of these attribute functions, I believe it is easy to understand.
896
+
897
+ 225
898
+ 00:19:32,000 --> 00:19:39,000
899
+ The first one returns minimal value in the column, and the second one returns the maximum value in
900
+
901
+ 226
902
+ 00:19:39,000 --> 00:19:39,000
903
+ the column.
904
+
905
+ 227
906
+ 00:19:40,000 --> 00:19:45,000
907
+ And on the slide, you can see example of queries executed against stable waste products.
908
+
909
+ 228
910
+ 00:19:46,000 --> 00:19:49,000
911
+ We extract max and mean price.
912
+
913
+ 229
914
+ 00:19:50,000 --> 00:19:52,000
915
+ The next aggregate function is count.
916
+
917
+ 230
918
+ 00:19:53,000 --> 00:19:59,000
919
+ The count function returns a number of roles that matches a specified material.
920
+
921
+ 231
922
+ 00:19:59,000 --> 00:20:02,000
923
+ You can also find query example on the slide.
924
+
925
+ 232
926
+ 00:20:03,000 --> 00:20:07,000
927
+ The average function returns the average value of a number of column.
928
+
929
+ 233
930
+ 00:20:08,000 --> 00:20:12,000
931
+ The sum function returns is a total sum of a number.
932
+
933
+ 234
934
+ 00:20:12,000 --> 00:20:14,000
935
+ A column is everything clear.
936
+
937
+ 235
938
+ 00:20:15,000 --> 00:20:20,000
939
+ Let's learn now group by keywords that are often used together with aggregate functions.
940
+
941
+ 236
942
+ 00:20:21,000 --> 00:20:28,000
943
+ Zeiger by statement groups rows that have the same values in the summary rows, it is often used with
944
+
945
+ 237
946
+ 00:20:28,000 --> 00:20:29,000
947
+ aggregate functions.
948
+
949
+ 238
950
+ 00:20:30,000 --> 00:20:35,000
951
+ The group by statement groups rows that have the same values in the summary rose.
952
+
953
+ 239
954
+ 00:20:35,000 --> 00:20:43,000
955
+ It is often used with aggregate functions like count marks mean some average subgroups, the results
956
+
957
+ 240
958
+ 00:20:43,000 --> 00:20:45,000
959
+ said by one or more columns.
960
+
961
+ 241
962
+ 00:20:45,000 --> 00:20:47,000
963
+ Let's reverse this on real demo.
964
+
965
+ 242
966
+ 00:20:48,000 --> 00:20:52,000
967
+ We are going them a group by statement, an example of user table.
968
+
969
+ 243
970
+ 00:20:53,000 --> 00:20:57,000
971
+ Let's find the most used a last name among our users.
972
+
973
+ 244
974
+ 00:20:58,000 --> 00:21:05,000
975
+ We know that last name in our app is not unique and we want to understand how much users used the same
976
+
977
+ 245
978
+ 00:21:05,000 --> 00:21:06,000
979
+ last name.
980
+
981
+ 246
982
+ 00:21:06,000 --> 00:21:13,000
983
+ I want select total count of all rows and displays this count as a mount attribute.
984
+
985
+ 247
986
+ 00:21:13,000 --> 00:21:20,000
987
+ And also, I want to extract the last name from user table and group results by a last name.
988
+
989
+ 248
990
+ 00:21:20,000 --> 00:21:22,000
991
+ That's executed this query.
992
+
993
+ 249
994
+ 00:21:22,000 --> 00:21:26,000
995
+ You can see that we have two people with even our last name.
996
+
997
+ 250
998
+ 00:21:26,000 --> 00:21:29,000
999
+ And one user with Komarov last name.
1000
+
1001
+ 251
1002
+ 00:21:29,000 --> 00:21:30,000
1003
+ And then the results.
1004
+
1005
+ 252
1006
+ 00:21:30,000 --> 00:21:33,000
1007
+ That count has been returned as a mound column.
1008
+
1009
+ 253
1010
+ 00:21:34,000 --> 00:21:41,000
1011
+ When I wrote this query, I used this error automatically because when you use aggregate functions,
1012
+
1013
+ 254
1014
+ 00:21:41,000 --> 00:21:45,000
1015
+ you also ones that column would have meaningful name.
1016
+
1017
+ 255
1018
+ 00:21:46,000 --> 00:21:47,000
1019
+ The syntax is simple.
1020
+
1021
+ 256
1022
+ 00:21:47,000 --> 00:21:53,000
1023
+ You use ASCII words and specifies a desert attribute name, sequel aliases.
1024
+
1025
+ 257
1026
+ 00:21:53,000 --> 00:21:58,000
1027
+ I used to give a table or column in the table at temporary name.
1028
+
1029
+ 258
1030
+ 00:21:58,000 --> 00:22:05,000
1031
+ Aliases are often used to make column names more readable, and A. only exists for the duration of that
1032
+
1033
+ 259
1034
+ 00:22:05,000 --> 00:22:11,000
1035
+ query and A. is created was SE keywords in my sequel.
1036
+
1037
+ 260
1038
+ 00:22:11,000 --> 00:22:16,000
1039
+ I usually omit ASCII word and use else straight away.
1040
+
1041
+ 261
1042
+ 00:22:17,000 --> 00:22:23,000
1043
+ We grouped our result by last name and managed to receive a result like this hobs.
1044
+
1045
+ 262
1046
+ 00:22:23,000 --> 00:22:24,000
1047
+ This is clear now.
1048
+
1049
+ 263
1050
+ 00:22:25,000 --> 00:22:33,000
1051
+ Another interesting saying that when you use group by keywords, you can apply condition to groups.
1052
+
1053
+ 264
1054
+ 00:22:33,000 --> 00:22:39,000
1055
+ To do this, you have to use havant keywords in very, very simplified words.
1056
+
1057
+ 265
1058
+ 00:22:39,000 --> 00:22:47,000
1059
+ Heaven is the same as where in regular select statements, the difference is that you can't apply where
1060
+
1061
+ 266
1062
+ 00:22:47,000 --> 00:22:55,000
1063
+ after group by statement, because where is applied for each sample while reviewing each records, whereas
1064
+
1065
+ 267
1066
+ 00:22:55,000 --> 00:22:58,000
1067
+ haven't may be applied to the group of tables.
1068
+
1069
+ 268
1070
+ 00:22:58,000 --> 00:23:06,000
1071
+ Once we iterated over records in table workflows introduces a condition on individual rows, having
1072
+
1073
+ 269
1074
+ 00:23:06,000 --> 00:23:09,000
1075
+ close introduces a condition on aggregations.
1076
+
1077
+ 270
1078
+ 00:23:10,000 --> 00:23:13,000
1079
+ Does it make sense from human language?
1080
+
1081
+ 271
1082
+ 00:23:13,000 --> 00:23:15,000
1083
+ We have few more important statements to learn.
1084
+
1085
+ 272
1086
+ 00:23:16,000 --> 00:23:18,000
1087
+ Let's learn Insert statement.
1088
+
1089
+ 273
1090
+ 00:23:18,000 --> 00:23:23,000
1091
+ Basically, this statement is used to insert new records in the table.
1092
+
1093
+ 274
1094
+ 00:23:23,000 --> 00:23:32,000
1095
+ The general structure of insert statement looks like this insert into table name lists of columns where
1096
+
1097
+ 275
1098
+ 00:23:32,000 --> 00:23:33,000
1099
+ you want to insert values.
1100
+
1101
+ 276
1102
+ 00:23:34,000 --> 00:23:38,000
1103
+ After that, gross values, keyword and list of values.
1104
+
1105
+ 277
1106
+ 00:23:39,000 --> 00:23:45,000
1107
+ This is the most common syntax of insert statement, but definitely is a resource a way to make simple
1108
+
1109
+ 278
1110
+ 00:23:45,000 --> 00:23:47,000
1111
+ things more complex.
1112
+
1113
+ 279
1114
+ 00:23:47,000 --> 00:23:48,000
1115
+ Just joking.
1116
+
1117
+ 280
1118
+ 00:23:49,000 --> 00:23:55,000
1119
+ But indeed, there might be different variations of insert statements in attachments to the media.
1120
+
1121
+ 281
1122
+ 00:23:55,000 --> 00:24:00,000
1123
+ You will find Link to the official documentation about insert statement in my sequel.
1124
+
1125
+ 282
1126
+ 00:24:01,000 --> 00:24:07,000
1127
+ Xanax thinks that you have to remember about insert statements inserts, but suffice to table where
1128
+
1129
+ 283
1130
+ 00:24:07,000 --> 00:24:11,000
1131
+ data will be inserted into we can omit column.
1132
+
1133
+ 284
1134
+ 00:24:12,000 --> 00:24:19,000
1135
+ If a column is amended, each value must be provided if you include in columns that can be listed in
1136
+
1137
+ 285
1138
+ 00:24:19,000 --> 00:24:25,000
1139
+ any order value specifies the data that you want to insert into the table.
1140
+
1141
+ 286
1142
+ 00:24:26,000 --> 00:24:30,000
1143
+ Value is required in certain and I'm just throwing into a word.
1144
+
1145
+ 287
1146
+ 00:24:30,000 --> 00:24:34,000
1147
+ Char Ortex column inserts a single space.
1148
+
1149
+ 288
1150
+ 00:24:35,000 --> 00:24:43,000
1151
+ All trading spaces are removed from data inserted into large columns, except in strings that contain
1152
+
1153
+ 289
1154
+ 00:24:43,000 --> 00:24:44,000
1155
+ only spaces.
1156
+
1157
+ 290
1158
+ 00:24:44,000 --> 00:24:47,000
1159
+ This strings are truncated to a single space.
1160
+
1161
+ 291
1162
+ 00:24:49,000 --> 00:24:57,000
1163
+ If an insert statement violates a constraint, default or rule, or if it is wrong data type, the statement
1164
+
1165
+ 292
1166
+ 00:24:57,000 --> 00:25:01,000
1167
+ fails and sequels, server displays and error message.
1168
+
1169
+ 293
1170
+ 00:25:02,000 --> 00:25:09,000
1171
+ Let's insert a few rows in our user table on the screen, you can see example often search query.
1172
+
1173
+ 294
1174
+ 00:25:09,000 --> 00:25:16,000
1175
+ We want to insert the records, but tensions at one record has EFCC use a roll value specified.
1176
+
1177
+ 295
1178
+ 00:25:17,000 --> 00:25:24,000
1179
+ And another record doesn't have the number of values should margins the number of columns we listed.
1180
+
1181
+ 296
1182
+ 00:25:25,000 --> 00:25:32,000
1183
+ So let's execute the query insert statement or iTunes has a number of how many rows have been impacted.
1184
+
1185
+ 297
1186
+ 00:25:32,000 --> 00:25:37,000
1187
+ After execution of this query, we impacted two rows in total.
1188
+
1189
+ 298
1190
+ 00:25:37,000 --> 00:25:44,000
1191
+ Now we can select all rows in our user table and make sure that we inserted two records.
1192
+
1193
+ 299
1194
+ 00:25:45,000 --> 00:25:46,000
1195
+ Is it clear?
1196
+
1197
+ 300
1198
+ 00:25:47,000 --> 00:25:49,000
1199
+ If yes, then let's proceed.
1200
+
1201
+ 301
1202
+ 00:25:49,000 --> 00:25:54,000
1203
+ The update statement is used to modify the existing records.
1204
+
1205
+ 302
1206
+ 00:25:54,000 --> 00:25:56,000
1207
+ In the table is a general query.
1208
+
1209
+ 303
1210
+ 00:25:56,000 --> 00:25:58,000
1211
+ Structure looks like this.
1212
+
1213
+ 304
1214
+ 00:25:58,000 --> 00:26:00,000
1215
+ You start with update keywords.
1216
+
1217
+ 305
1218
+ 00:26:01,000 --> 00:26:08,000
1219
+ After that specified table name after set keywords, we need to list pairs of column name and related
1220
+
1221
+ 306
1222
+ 00:26:08,000 --> 00:26:09,000
1223
+ value.
1224
+
1225
+ 307
1226
+ 00:26:09,000 --> 00:26:10,000
1227
+ Separate was comma.
1228
+
1229
+ 308
1230
+ 00:26:11,000 --> 00:26:17,000
1231
+ Optionally, we can specify where a close to select rules that we want to accommodate and we can apply
1232
+
1233
+ 309
1234
+ 00:26:17,000 --> 00:26:18,000
1235
+ limit.
1236
+
1237
+ 310
1238
+ 00:26:19,000 --> 00:26:27,000
1239
+ The where clause, if given, specifies the conditions, is that identify which rose to update with
1240
+
1241
+ 311
1242
+ 00:26:27,000 --> 00:26:28,000
1243
+ nowhere close.
1244
+
1245
+ 312
1246
+ 00:26:28,000 --> 00:26:33,000
1247
+ All the rules are updated if the order by clause is specified.
1248
+
1249
+ 313
1250
+ 00:26:34,000 --> 00:26:42,000
1251
+ Zero's updated in the order that a specified the limit clause places a limit on the number of rules
1252
+
1253
+ 314
1254
+ 00:26:42,000 --> 00:26:43,000
1255
+ that can be updated.
1256
+
1257
+ 315
1258
+ 00:26:44,000 --> 00:26:50,000
1259
+ In our example, we decided to change email for our user and assign new role for him.
1260
+
1261
+ 316
1262
+ 00:26:51,000 --> 00:26:58,000
1263
+ An example you can see that I assign new value to email attribute and to f k user role attribute.
1264
+
1265
+ 317
1266
+ 00:26:59,000 --> 00:27:05,000
1267
+ I use very close to update on the one row I have unique identifier in this table.
1268
+
1269
+ 318
1270
+ 00:27:05,000 --> 00:27:08,000
1271
+ That's why, in workflows, I use ID.
1272
+
1273
+ 319
1274
+ 00:27:09,000 --> 00:27:17,000
1275
+ Let me execute this squaring I'mnot statement also returns a number of updated throws with successfully
1276
+
1277
+ 320
1278
+ 00:27:17,000 --> 00:27:18,000
1279
+ updated one rule.
1280
+
1281
+ 321
1282
+ 00:27:18,000 --> 00:27:23,000
1283
+ We can check our table to make sure that email and foreign key value is changed.
1284
+
1285
+ 322
1286
+ 00:27:24,000 --> 00:27:27,000
1287
+ If everything is clear, then let's move on.
1288
+
1289
+ 323
1290
+ 00:27:28,000 --> 00:27:34,000
1291
+ And the last, but not least for today, the lead statement, the statement is used to delete existing
1292
+
1293
+ 324
1294
+ 00:27:34,000 --> 00:27:35,000
1295
+ records in the table.
1296
+
1297
+ 325
1298
+ 00:27:36,000 --> 00:27:43,000
1299
+ One important thing to mention here is that in case you would admit where close, you would remove all
1300
+
1301
+ 326
1302
+ 00:27:43,000 --> 00:27:45,000
1303
+ records from the table.
1304
+
1305
+ 327
1306
+ 00:27:45,000 --> 00:27:48,000
1307
+ So be very attentive with this query.
1308
+
1309
+ 328
1310
+ 00:27:49,000 --> 00:27:54,000
1311
+ According to documentation, you can also use or them by and limit the keywords.
1312
+
1313
+ 329
1314
+ 00:27:55,000 --> 00:27:58,000
1315
+ In that example, we decided to remove one row.
1316
+
1317
+ 330
1318
+ 00:27:58,000 --> 00:28:04,000
1319
+ Here is how it look like I specified three of the role that I want to remove.
1320
+
1321
+ 331
1322
+ 00:28:05,000 --> 00:28:06,000
1323
+ Let's execute this query.
1324
+
1325
+ 332
1326
+ 00:28:07,000 --> 00:28:13,000
1327
+ And you can see in logs that the lead statement also returns number of rows that were impacted with
1328
+
1329
+ 333
1330
+ 00:28:13,000 --> 00:28:13,000
1331
+ this query.
1332
+
1333
+ 334
1334
+ 00:28:14,000 --> 00:28:17,000
1335
+ That's all I wanted to share with you in this lesson.
1336
+
1337
+ 335
1338
+ 00:28:17,000 --> 00:28:19,000
1339
+ Let's recap what we have learned today.
1340
+
1341
+ 336
1342
+ 00:28:20,000 --> 00:28:26,000
1343
+ In this lesson, we learned select statements, I showed you select statements with different options,
1344
+
1345
+ 337
1346
+ 00:28:27,000 --> 00:28:35,000
1347
+ including selecting Rose is ordering wear clothes, distinct selection search by pardon Lehman's a number
1348
+
1349
+ 338
1350
+ 00:28:35,000 --> 00:28:39,000
1351
+ of rose to be returned grouping and the blind condition on groups.
1352
+
1353
+ 339
1354
+ 00:28:40,000 --> 00:28:43,000
1355
+ You learned different skill operators.
1356
+
1357
+ 340
1358
+ 00:28:44,000 --> 00:28:48,000
1359
+ Now you know what aggregate functions are and how to work with them.
1360
+
1361
+ 341
1362
+ 00:28:48,000 --> 00:28:52,000
1363
+ I showed you how to work with others in school.
1364
+
1365
+ 342
1366
+ 00:28:52,000 --> 00:28:57,000
1367
+ And also, we discussed insert, update and delete statements.
1368
+
1369
+ 343
1370
+ 00:28:58,000 --> 00:28:59,000
1371
+ That's all for this lesson.
1372
+
1373
+ 344
1374
+ 00:29:00,000 --> 00:29:02,000
1375
+ Thanks a lot for your attention.
1376
+
1377
+ 345
1378
+ 00:29:02,000 --> 00:29:05,000
1379
+ Have a great day and see you in the next lesson.
1380
+
48 - SQL/003 JOIN Queries, UNION & Subqueries_en.srt ADDED
@@ -0,0 +1,732 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:06,000 --> 00:00:06,000
3
+ Hello, Jim.
4
+
5
+ 2
6
+ 00:00:06,000 --> 00:00:12,000
7
+ In this lesson, we continue to learn sequel and will focus on such important group of queries as joint
8
+
9
+ 3
10
+ 00:00:12,000 --> 00:00:13,000
11
+ queries.
12
+
13
+ 4
14
+ 00:00:13,000 --> 00:00:19,000
15
+ Considering the fact we are dealing with relational databases very often we have to create joint queries
16
+
17
+ 5
18
+ 00:00:19,000 --> 00:00:20,000
19
+ to multiple tables.
20
+
21
+ 6
22
+ 00:00:21,000 --> 00:00:26,000
23
+ And also, we are going to review a few more SQL statements that I didn't cover in previous lesson plans
24
+
25
+ 7
26
+ 00:00:26,000 --> 00:00:27,000
27
+ that are too small.
28
+
29
+ 8
30
+ 00:00:27,000 --> 00:00:33,000
31
+ For a separate lesson in the lesson, we'll put our focus on Jones sequel statements.
32
+
33
+ 9
34
+ 00:00:33,000 --> 00:00:42,000
35
+ We're going to review different types of June queries that includes in the left right cross and full
36
+
37
+ 10
38
+ 00:00:42,000 --> 00:00:43,000
39
+ order giants.
40
+
41
+ 11
42
+ 00:00:43,000 --> 00:00:47,000
43
+ I also prepare examples for each case to review Is you?
44
+
45
+ 12
46
+ 00:00:47,000 --> 00:00:53,000
47
+ You will be able to find all examples that will review each lesson in attachments to the veto.
48
+
49
+ 13
50
+ 00:00:54,000 --> 00:01:00,000
51
+ Also, we are going to learn union keyword and understand how it works and that sense of the lesson.
52
+
53
+ 14
54
+ 00:01:00,000 --> 00:01:04,000
55
+ I will teach you how to construct queries with sub queries.
56
+
57
+ 15
58
+ 00:01:05,000 --> 00:01:06,000
59
+ Let's start our lesson.
60
+
61
+ 16
62
+ 00:01:07,000 --> 00:01:12,000
63
+ I believe that you already understood that in relational databases, we split data between different
64
+
65
+ 17
66
+ 00:01:12,000 --> 00:01:16,000
67
+ tables and apply normalization with data redundancy.
68
+
69
+ 18
70
+ 00:01:17,000 --> 00:01:25,000
71
+ This means that to extract data that you need, sometimes you need to execute so-called joint queries
72
+
73
+ 19
74
+ 00:01:25,000 --> 00:01:33,000
75
+ against not one, but multiple tables in step joint query commands, columns from one or more tables
76
+
77
+ 20
78
+ 00:01:33,000 --> 00:01:42,000
79
+ into a new table and see standard sequels insofar as five types of joy in the left order, right order,
80
+
81
+ 21
82
+ 00:01:42,000 --> 00:01:44,000
83
+ food order and cross.
84
+
85
+ 22
86
+ 00:01:45,000 --> 00:01:50,000
87
+ Let's learn how these joints look in theory, and after that, we review practice examples.
88
+
89
+ 23
90
+ 00:01:51,000 --> 00:01:58,000
91
+ Further examples will be shown considering these two tables user and role that actions at user table
92
+
93
+ 24
94
+ 00:01:58,000 --> 00:02:06,000
95
+ contains foreign key to role table and also Xerri users without rules and also the roles that are not
96
+
97
+ 25
98
+ 00:02:06,000 --> 00:02:08,000
99
+ assigned to any user.
100
+
101
+ 26
102
+ 00:02:09,000 --> 00:02:14,000
103
+ The same tables I have in my school, we created zones during the previous lessons.
104
+
105
+ 27
106
+ 00:02:15,000 --> 00:02:19,000
107
+ If you want to repeat queries after me, make sure you have the same tables.
108
+
109
+ 28
110
+ 00:02:20,000 --> 00:02:28,000
111
+ The best visualization of Junqueras is these two circles your circles represent the set of records that
112
+
113
+ 29
114
+ 00:02:28,000 --> 00:02:29,000
115
+ exist in two tables.
116
+
117
+ 30
118
+ 00:02:30,000 --> 00:02:36,000
119
+ Basically, you can see that one table is on the left and another table is on the right.
120
+
121
+ 31
122
+ 00:02:36,000 --> 00:02:44,000
123
+ That tangent that these two circles have intersection zigzag in the records is it can be mapped between
124
+
125
+ 32
126
+ 00:02:44,000 --> 00:02:45,000
127
+ each other.
128
+
129
+ 33
130
+ 00:02:45,000 --> 00:02:54,000
131
+ In simple words, the area inside these two circles is called in a joint area that includes space without
132
+
133
+ 34
134
+ 00:02:54,000 --> 00:02:55,000
135
+ intersection.
136
+
137
+ 35
138
+ 00:02:55,000 --> 00:02:58,000
139
+ It's called the left and right or the John.
140
+
141
+ 36
142
+ 00:02:59,000 --> 00:03:06,000
143
+ Anyway, we're going to review each of you and type on real examples and one by one, and let's start
144
+
145
+ 37
146
+ 00:03:06,000 --> 00:03:07,000
147
+ from Injune.
148
+
149
+ 38
150
+ 00:03:07,000 --> 00:03:14,000
151
+ You can imagine it as an intersection between two tables and enjoying requires each row in the two joints
152
+
153
+ 39
154
+ 00:03:14,000 --> 00:03:17,000
155
+ tables to have matching column values.
156
+
157
+ 40
158
+ 00:03:18,000 --> 00:03:25,000
159
+ This is exactly the moment when we'll use our foreign keys to establish connections between tables in
160
+
161
+ 41
162
+ 00:03:25,000 --> 00:03:27,000
163
+ a joint creates and result table.
164
+
165
+ 42
166
+ 00:03:27,000 --> 00:03:35,000
167
+ By combining column values of two tables based upon the joint predicate, imagine that we have two tables.
168
+
169
+ 43
170
+ 00:03:35,000 --> 00:03:37,000
171
+ Z are A and B.
172
+
173
+ 44
174
+ 00:03:37,000 --> 00:03:47,000
175
+ Table Zucchero compares each row of a with each row of D to find all pairs of rows that satisfy the
176
+
177
+ 45
178
+ 00:03:47,000 --> 00:03:49,000
179
+ joint pretty good ones.
180
+
181
+ 46
182
+ 00:03:49,000 --> 00:03:52,000
183
+ A joint project is satisfied by matching non low values.
184
+
185
+ 47
186
+ 00:03:52,000 --> 00:03:59,000
187
+ Common values for each pair of rows of A and B are combined into result.
188
+
189
+ 48
190
+ 00:03:59,000 --> 00:04:08,000
191
+ Row six specifies two different syntactical ways to express joints z explicit joint notation and same
192
+
193
+ 49
194
+ 00:04:08,000 --> 00:04:14,000
195
+ place adjourn notation simply to join notation is no longer considered the best practice.
196
+
197
+ 50
198
+ 00:04:14,000 --> 00:04:17,000
199
+ Also, database system still supported.
200
+
201
+ 51
202
+ 00:04:17,000 --> 00:04:26,000
203
+ The explicit annotation uses a joint keyword optionally preceded by a keyword to specify the table to
204
+
205
+ 52
206
+ 00:04:26,000 --> 00:04:30,000
207
+ join and the only keyword to specify the precursor for the joint.
208
+
209
+ 53
210
+ 00:04:31,000 --> 00:04:34,000
211
+ Today, we're going to review a different query examples.
212
+
213
+ 54
214
+ 00:04:35,000 --> 00:04:36,000
215
+ I save all of them.
216
+
217
+ 55
218
+ 00:04:36,000 --> 00:04:40,000
219
+ You will be able to find those in attachments to this lesson.
220
+
221
+ 56
222
+ 00:04:41,000 --> 00:04:45,000
223
+ Let me show you a demo of in our John Kerry just to remind you.
224
+
225
+ 57
226
+ 00:04:45,000 --> 00:04:48,000
227
+ Here is how our user table looks like.
228
+
229
+ 58
230
+ 00:04:48,000 --> 00:04:50,000
231
+ Not all users have role.
232
+
233
+ 59
234
+ 00:04:51,000 --> 00:04:53,000
235
+ And here's how our old table looks like.
236
+
237
+ 60
238
+ 00:04:54,000 --> 00:04:59,000
239
+ Zero rules that are not a science None of the users is that clear.
240
+
241
+ 61
242
+ 00:05:00,000 --> 00:05:06,000
243
+ Now let's select last name and role name of all users with their roles.
244
+
245
+ 62
246
+ 00:05:06,000 --> 00:05:11,000
247
+ We will not take into account users without rows and rows without users.
248
+
249
+ 63
250
+ 00:05:12,000 --> 00:05:16,000
251
+ I write select fields that they need and their attention.
252
+
253
+ 64
254
+ 00:05:16,000 --> 00:05:21,000
255
+ I use tables on us to specify which fields from each table I want to extract.
256
+
257
+ 65
258
+ 00:05:22,000 --> 00:05:26,000
259
+ After that, I write from users table and pay attention.
260
+
261
+ 66
262
+ 00:05:26,000 --> 00:05:34,000
263
+ I specify August here you is just a character that seems for me to be good as an alias for this table.
264
+
265
+ 67
266
+ 00:05:35,000 --> 00:05:42,000
267
+ Basically, you last name in our query is a reference to the last name field in user table.
268
+
269
+ 68
270
+ 00:05:43,000 --> 00:05:43,000
271
+ Is it clear?
272
+
273
+ 69
274
+ 00:05:44,000 --> 00:05:52,000
275
+ After that, I right join Kyra, as we discussed, I can admit you, Akiva, and specify tables that
276
+
277
+ 70
278
+ 00:05:52,000 --> 00:05:58,000
279
+ I want to join again and ask for old table is specified next to the role table name.
280
+
281
+ 71
282
+ 00:05:59,000 --> 00:06:05,000
283
+ And after that, I need to specify what rule will be used for my records in two different tables.
284
+
285
+ 72
286
+ 00:06:06,000 --> 00:06:10,000
287
+ That's why I write on key word and specifies the rule.
288
+
289
+ 73
290
+ 00:06:11,000 --> 00:06:17,000
291
+ I do field from rule table should match with the f k zero field from user table.
292
+
293
+ 74
294
+ 00:06:17,000 --> 00:06:23,000
295
+ If you followed your course and you didn't miss previous lessons, you should remember that f k is a
296
+
297
+ 75
298
+ 00:06:23,000 --> 00:06:25,000
299
+ rule is a foreign key.
300
+
301
+ 76
302
+ 00:06:26,000 --> 00:06:33,000
303
+ Now, I am sure that this query will return US ballot information that's executable, and we see two
304
+
305
+ 77
306
+ 00:06:33,000 --> 00:06:39,000
307
+ rows return on the last name and roll like we requested any questions.
308
+
309
+ 78
310
+ 00:06:39,000 --> 00:06:40,000
311
+ So 14.
312
+
313
+ 79
314
+ 00:06:40,000 --> 00:06:45,000
315
+ In case of any questions, please read them in comments below this video.
316
+
317
+ 80
318
+ 00:06:46,000 --> 00:06:48,000
319
+ Now, let's discuss Order Jones.
320
+
321
+ 81
322
+ 00:06:49,000 --> 00:06:57,000
323
+ So how is this author joining verbs, the Jones table three themes each row, even if no awesome marching
324
+
325
+ 82
326
+ 00:06:57,000 --> 00:06:58,000
327
+ rule exists.
328
+
329
+ 83
330
+ 00:06:58,000 --> 00:07:07,000
331
+ All author joins Subdivide further into left joints, writes joints and full order joints based on which
332
+
333
+ 84
334
+ 00:07:07,000 --> 00:07:09,000
335
+ tables throw you would like to retain.
336
+
337
+ 85
338
+ 00:07:10,000 --> 00:07:13,000
339
+ How to understand where is that and where is right table?
340
+
341
+ 86
342
+ 00:07:14,000 --> 00:07:21,000
343
+ It depends on which side from joint keyword the name is specified as a result of left or the joint or
344
+
345
+ 87
346
+ 00:07:21,000 --> 00:07:22,000
347
+ simply left.
348
+
349
+ 88
350
+ 00:07:22,000 --> 00:07:24,000
351
+ Join for tables.
352
+
353
+ 89
354
+ 00:07:24,000 --> 00:07:32,000
355
+ A and B always contains all rows of the lap table, even if the joint condition doesn't find any metric
356
+
357
+ 90
358
+ 00:07:32,000 --> 00:07:33,000
359
+ row in the right table.
360
+
361
+ 91
362
+ 00:07:34,000 --> 00:07:41,000
363
+ This means that these are all close matches, zero rows in the right table for a given row in the left
364
+
365
+ 92
366
+ 00:07:41,000 --> 00:07:41,000
367
+ table.
368
+
369
+ 93
370
+ 00:07:42,000 --> 00:07:49,000
371
+ The joint will still return a row in the result, but with no in each column from the right table and
372
+
373
+ 94
374
+ 00:07:49,000 --> 00:07:51,000
375
+ left or the joint returns.
376
+
377
+ 95
378
+ 00:07:51,000 --> 00:07:59,000
379
+ All the values from an integer plus all values in the left table that do not match through the right
380
+
381
+ 96
382
+ 00:07:59,000 --> 00:08:03,000
383
+ table, including rows, was now well used in Zelinka column.
384
+
385
+ 97
386
+ 00:08:04,000 --> 00:08:09,000
387
+ Is it clear the same principle applies to the right auto joint?
388
+
389
+ 98
390
+ 00:08:09,000 --> 00:08:16,000
391
+ But in this case, we return all records from inner joint plus all records from right the bill, even
392
+
393
+ 99
394
+ 00:08:16,000 --> 00:08:23,000
395
+ if they don't match to any record in left table and the last stop of order, John is full order junk
396
+
397
+ 100
398
+ 00:08:24,000 --> 00:08:32,000
399
+ conceptual at full auto joint combines the effect of applying both left and right, or the joints and
400
+
401
+ 101
402
+ 00:08:32,000 --> 00:08:37,000
403
+ throws that don't have Malcolm in the table will have no values in the result set.
404
+
405
+ 102
406
+ 00:08:38,000 --> 00:08:41,000
407
+ Let's now review these types of joints one real example.
408
+
409
+ 103
410
+ 00:08:42,000 --> 00:08:43,000
411
+ Let's start from the left, Joan.
412
+
413
+ 104
414
+ 00:08:44,000 --> 00:08:51,000
415
+ Basically, we would take the same queries that we reviewed neurons in the demo and will add left keema.
416
+
417
+ 105
418
+ 00:08:52,000 --> 00:08:55,000
419
+ Let's execute it now and see what will be returned.
420
+
421
+ 106
422
+ 00:08:56,000 --> 00:09:04,000
423
+ And you can see that we received all last means from our user table that is on the left from joint keyword
424
+
425
+ 107
426
+ 00:09:04,000 --> 00:09:08,000
427
+ and for records where any match wasn't found in row table.
428
+
429
+ 108
430
+ 00:09:09,000 --> 00:09:13,000
431
+ We just returned now that's called left joint right.
432
+
433
+ 109
434
+ 00:09:13,000 --> 00:09:20,000
435
+ June would look opposite way in this case, which on all road names, even if we don't have users assigned
436
+
437
+ 110
438
+ 00:09:20,000 --> 00:09:28,000
439
+ to this row because the table is on the right from June Cleaver and this is right joint query, does
440
+
441
+ 111
442
+ 00:09:28,000 --> 00:09:29,000
443
+ it make sense?
444
+
445
+ 112
446
+ 00:09:30,000 --> 00:09:32,000
447
+ Now, let me show you a question.
448
+
449
+ 113
450
+ 00:09:32,000 --> 00:09:38,000
451
+ We just remove credit cards and leave on the John Key take into account.
452
+
453
+ 114
454
+ 00:09:38,000 --> 00:09:42,000
455
+ We have four records in user table and four records in Table.
456
+
457
+ 115
458
+ 00:09:43,000 --> 00:09:46,000
459
+ We're going to receive in total 16 records.
460
+
461
+ 116
462
+ 00:09:46,000 --> 00:09:52,000
463
+ Basically, each records from one table should be mapped was each row from another table.
464
+
465
+ 117
466
+ 00:09:53,000 --> 00:09:57,000
467
+ We receive all possible combinations of wrappers from each table.
468
+
469
+ 118
470
+ 00:09:57,000 --> 00:10:04,000
471
+ To be honest, this type of query is interesting to know from series side, but probably it has limited
472
+
473
+ 119
474
+ 00:10:04,000 --> 00:10:06,000
475
+ areas for use in in business cases.
476
+
477
+ 120
478
+ 00:10:06,000 --> 00:10:11,000
479
+ It is rare seeing when you need to find combinations between all records from two tables.
480
+
481
+ 121
482
+ 00:10:12,000 --> 00:10:16,000
483
+ And the last but not least type of joint is full order.
484
+
485
+ 122
486
+ 00:10:17,000 --> 00:10:20,000
487
+ In my school, it can be implemented with the help of union keyword.
488
+
489
+ 123
490
+ 00:10:21,000 --> 00:10:23,000
491
+ What is Union Keyword?
492
+
493
+ 124
494
+ 00:10:23,000 --> 00:10:27,000
495
+ It combines two queries in one single query to the database.
496
+
497
+ 125
498
+ 00:10:27,000 --> 00:10:32,000
499
+ In our case, we need to combine two queries with two joints left and right.
500
+
501
+ 126
502
+ 00:10:32,000 --> 00:10:35,000
503
+ And you can see that I connect to select statements.
504
+
505
+ 127
506
+ 00:10:35,000 --> 00:10:43,000
507
+ Was Union Kuvira that's executed this query, and we can see that we received all full records from
508
+
509
+ 128
510
+ 00:10:43,000 --> 00:10:49,000
511
+ user table and all four records from the row table, even despite not all the records have mapping.
512
+
513
+ 129
514
+ 00:10:50,000 --> 00:10:52,000
515
+ This makes sense homes.
516
+
517
+ 130
518
+ 00:10:52,000 --> 00:10:53,000
519
+ It's now with this example.
520
+
521
+ 131
522
+ 00:10:53,000 --> 00:10:58,000
523
+ Things become clearer and we also learned how union works.
524
+
525
+ 132
526
+ 00:10:59,000 --> 00:11:03,000
527
+ Usually, union is used when you are dealing with some archived data.
528
+
529
+ 133
530
+ 00:11:03,000 --> 00:11:11,000
531
+ When you queries a main table and operational or table was archived data regarding joints important
532
+
533
+ 134
534
+ 00:11:11,000 --> 00:11:16,000
535
+ things to know that in this way, you can join two and more tables.
536
+
537
+ 135
538
+ 00:11:17,000 --> 00:11:20,000
539
+ This will become important when you will come to the homework task.
540
+
541
+ 136
542
+ 00:11:21,000 --> 00:11:24,000
543
+ Imagines that you are dealing with many, many relationships.
544
+
545
+ 137
546
+ 00:11:24,000 --> 00:11:29,000
547
+ In this case, you have three tables that the disconnect between each other.
548
+
549
+ 138
550
+ 00:11:29,000 --> 00:11:31,000
551
+ This will be part of your home desk.
552
+
553
+ 139
554
+ 00:11:32,000 --> 00:11:35,000
555
+ I will also provide you with solutions as a home task.
556
+
557
+ 140
558
+ 00:11:35,000 --> 00:11:39,000
559
+ But I just want you to solve this task by itself first.
560
+
561
+ 141
562
+ 00:11:39,000 --> 00:11:44,000
563
+ The only one more topics that I'd love to discuss with you today is sub queries.
564
+
565
+ 142
566
+ 00:11:44,000 --> 00:11:49,000
567
+ This topic is too small for a separate lesson, but still important to know.
568
+
569
+ 143
570
+ 00:11:49,000 --> 00:11:51,000
571
+ I want to explain some queries.
572
+
573
+ 144
574
+ 00:11:52,000 --> 00:11:56,000
575
+ What if you would like to create condition was the result of another query.
576
+
577
+ 145
578
+ 00:11:57,000 --> 00:11:59,000
579
+ You can do so with the help of sub queries.
580
+
581
+ 146
582
+ 00:12:00,000 --> 00:12:04,000
583
+ A sub query is a sequel query nested inside a logic query.
584
+
585
+ 147
586
+ 00:12:05,000 --> 00:12:12,000
587
+ Sub query is also called and even a query or in there, so that while the statements contained in the
588
+
589
+ 148
590
+ 00:12:12,000 --> 00:12:21,000
591
+ sub query is also called an auto query or to select the inner query executes first before its parent
592
+
593
+ 149
594
+ 00:12:21,000 --> 00:12:27,000
595
+ query so that the results of an inner query can be passed to the auto query.
596
+
597
+ 150
598
+ 00:12:28,000 --> 00:12:33,000
599
+ You can use a sub query in a select insert, delete or update statements.
600
+
601
+ 151
602
+ 00:12:33,000 --> 00:12:39,000
603
+ A sub query is usually added within the very close of another SQL select statement.
604
+
605
+ 152
606
+ 00:12:39,000 --> 00:12:45,000
607
+ In our particular example, let's imagine that we want to extract users who have value in money column
608
+
609
+ 153
610
+ 00:12:45,000 --> 00:12:53,000
611
+ more than average money value across all users before you would be able to execute this kind of query.
612
+
613
+ 154
614
+ 00:12:53,000 --> 00:12:56,000
615
+ Let's make small adjustments in our tables.
616
+
617
+ 155
618
+ 00:12:56,000 --> 00:13:02,000
619
+ I need to add money column and fill it out with data to make your life easier.
620
+
621
+ 156
622
+ 00:13:03,000 --> 00:13:08,000
623
+ I prepared script for you that would add new column and populated with data.
624
+
625
+ 157
626
+ 00:13:09,000 --> 00:13:13,000
627
+ I am going to leave the reference to this script in attachments to this lesson.
628
+
629
+ 158
630
+ 00:13:14,000 --> 00:13:19,000
631
+ If you follow the course and you have the same structure, script will be executed without problem.
632
+
633
+ 159
634
+ 00:13:20,000 --> 00:13:28,000
635
+ Pay attention to the data type of money column 15 mins amount of decimal digits and two means that only
636
+
637
+ 160
638
+ 00:13:28,000 --> 00:13:30,000
639
+ two digits after point will be supported.
640
+
641
+ 161
642
+ 00:13:30,000 --> 00:13:38,000
643
+ Considering mass around and rules, OK, so once you executed this script, your user table should look
644
+
645
+ 162
646
+ 00:13:38,000 --> 00:13:39,000
647
+ like this.
648
+
649
+ 163
650
+ 00:13:40,000 --> 00:13:43,000
651
+ Now let me damari you how sub query works.
652
+
653
+ 164
654
+ 00:13:44,000 --> 00:13:46,000
655
+ We create regular select statements.
656
+
657
+ 165
658
+ 00:13:46,000 --> 00:13:52,000
659
+ We want to receive rows where money is more than average money amount, and that counts of all users.
660
+
661
+ 166
662
+ 00:13:53,000 --> 00:13:59,000
663
+ For this, I need to execute this sub query first understands the amount of money that can be used.
664
+
665
+ 167
666
+ 00:13:59,000 --> 00:14:03,000
667
+ In my order query, I put Sequeira in parentheses.
668
+
669
+ 168
670
+ 00:14:04,000 --> 00:14:05,000
671
+ Let's execute this query.
672
+
673
+ 169
674
+ 00:14:06,000 --> 00:14:13,000
675
+ Our money amount was this specific test data will be around five hundred sixty four and we have two
676
+
677
+ 170
678
+ 00:14:13,000 --> 00:14:19,000
679
+ rows returns with money amount higher as an average money amount than this.
680
+
681
+ 171
682
+ 00:14:19,000 --> 00:14:22,000
683
+ Now you can work with sub queries.
684
+
685
+ 172
686
+ 00:14:23,000 --> 00:14:23,000
687
+ That's all.
688
+
689
+ 173
690
+ 00:14:23,000 --> 00:14:24,000
691
+ What I wanted to share.
692
+
693
+ 174
694
+ 00:14:24,000 --> 00:14:25,000
695
+ Was you in this lesson?
696
+
697
+ 175
698
+ 00:14:26,000 --> 00:14:28,000
699
+ Let's recap what we have learned today.
700
+
701
+ 176
702
+ 00:14:29,000 --> 00:14:36,000
703
+ This lesson we learned what joints are after that we focus on different joint types moving around in
704
+
705
+ 177
706
+ 00:14:36,000 --> 00:14:40,000
707
+ the water, across joints and reviewed SQL queries.
708
+
709
+ 178
710
+ 00:14:41,000 --> 00:14:47,000
711
+ Now you know how to work with union keywords, and the answers will have some of you learned how to
712
+
713
+ 179
714
+ 00:14:47,000 --> 00:14:48,000
715
+ work with subwoofers.
716
+
717
+ 180
718
+ 00:14:49,000 --> 00:14:50,000
719
+ That's all for this lesson.
720
+
721
+ 181
722
+ 00:14:50,000 --> 00:14:52,000
723
+ Thanks a lot for your attention.
724
+
725
+ 182
726
+ 00:14:52,000 --> 00:14:53,000
727
+ Have a great day.
728
+
729
+ 183
730
+ 00:14:54,000 --> 00:14:55,000
731
+ See you next lesson.
732
+
48 - SQL/003 Query-Examples-that-were-shown-in-the-lesson.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/sql_queries/dml/joins
48 - SQL/external-links.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ 001 MySQL-Documentation-about-statements
3
+ https://dev.mysql.com/doc/refman/8.0/en/create-view.html
4
+
5
+ 001 Query-Examples-that-were-shown-in-the-lesson
6
+ https://github.com/AndriiPiatakha/learnit_java_core/tree/master/sql_queries/ddl
7
+
8
+ 002 INSERT-statement-documentation
9
+ https://dev.mysql.com/doc/refman/8.0/en/insert.html
10
+
11
+ 002 Query-Examples-that-were-shown-in-the-lesson
12
+ https://github.com/AndriiPiatakha/learnit_java_core/tree/master/sql_queries/dml
13
+
14
+ 003 Query-Examples-that-were-shown-in-the-lesson
15
+ https://github.com/AndriiPiatakha/learnit_java_core/tree/master/sql_queries/dml/joins
49 - Relational Databases (Advanced)/001 Find-folders-with-Views-Triggers-Stored-Procedures-and-Stored-Functions-SQL-query-examples-here.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/sql_queries/ddl
49 - Relational Databases (Advanced)/001 Views, Triggers, Stored Procedures & Functions_en.srt ADDED
@@ -0,0 +1,1548 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:06,000 --> 00:00:06,000
3
+ Hello, Jim.
4
+
5
+ 2
6
+ 00:00:06,000 --> 00:00:11,000
7
+ And this last one, we're going to learn some new concepts in a relational databases.
8
+
9
+ 3
10
+ 00:00:11,000 --> 00:00:16,000
11
+ I would explain what use triggers, stored procedures and stored functions are.
12
+
13
+ 4
14
+ 00:00:16,000 --> 00:00:23,000
15
+ Also, you will understand why we need them and how to work with them on practice, because today will
16
+
17
+ 5
18
+ 00:00:23,000 --> 00:00:24,000
19
+ have practical part, too.
20
+
21
+ 6
22
+ 00:00:25,000 --> 00:00:27,000
23
+ So be prepared for interesting lesson.
24
+
25
+ 7
26
+ 00:00:28,000 --> 00:00:30,000
27
+ We are going to go over each topic.
28
+
29
+ 8
30
+ 00:00:30,000 --> 00:00:37,000
31
+ One by one and one will focus on practical examples of use triggers, stored procedures and storage
32
+
33
+ 9
34
+ 00:00:37,000 --> 00:00:37,000
35
+ functions.
36
+
37
+ 10
38
+ 00:00:38,000 --> 00:00:44,000
39
+ I'm going also to explain just some new syntax features like, for example, single line and multi line
40
+
41
+ 11
42
+ 00:00:44,000 --> 00:00:47,000
43
+ commonsensical session variables.
44
+
45
+ 12
46
+ 00:00:47,000 --> 00:00:53,000
47
+ Also, I'll show you how you can change the limiter between SQL statements in my signal.
48
+
49
+ 13
50
+ 00:00:53,000 --> 00:00:55,000
51
+ Let's start our lesson.
52
+
53
+ 14
54
+ 00:00:55,000 --> 00:00:59,000
55
+ And the first thing that I'd like to review with you in this video is viewed.
56
+
57
+ 15
58
+ 00:01:00,000 --> 00:01:03,000
59
+ Let's understand first what is viewed in databases.
60
+
61
+ 16
62
+ 00:01:04,000 --> 00:01:06,000
63
+ We use virtual tables.
64
+
65
+ 17
66
+ 00:01:06,000 --> 00:01:10,000
67
+ There are only a structure and contain no data.
68
+
69
+ 18
70
+ 00:01:10,000 --> 00:01:15,000
71
+ Their purpose is to allow a user to see a subset of the actual data.
72
+
73
+ 19
74
+ 00:01:16,000 --> 00:01:20,000
75
+ You can consist of a subset of one or more tables.
76
+
77
+ 20
78
+ 00:01:20,000 --> 00:01:25,000
79
+ What might be the reasons for creating and use zero might be different reasons.
80
+
81
+ 21
82
+ 00:01:26,000 --> 00:01:28,000
83
+ Among the advantages of using the use, it is worse.
84
+
85
+ 22
86
+ 00:01:28,000 --> 00:01:31,000
87
+ Dimension restricts the view of a table.
88
+
89
+ 23
90
+ 00:01:32,000 --> 00:01:39,000
91
+ For example, you can create a view that contains not all fields, but only some of them that don't
92
+
93
+ 24
94
+ 00:01:39,000 --> 00:01:40,000
95
+ have any sensitive data.
96
+
97
+ 25
98
+ 00:01:41,000 --> 00:01:48,000
99
+ So you can hide some of columns in tables in larger organizations where many developers may be working
100
+
101
+ 26
102
+ 00:01:48,000 --> 00:01:49,000
103
+ on a project.
104
+
105
+ 27
106
+ 00:01:49,000 --> 00:01:54,000
107
+ We use allowed developers to access unused data they need.
108
+
109
+ 28
110
+ 00:01:55,000 --> 00:02:03,000
111
+ June two or more tables and show it as one object to use it instead of constantly right in June, Junqueras,
112
+
113
+ 29
114
+ 00:02:03,000 --> 00:02:11,000
115
+ you can create value for most often joins and lets user to watch the whole attributes as one database
116
+
117
+ 30
118
+ 00:02:11,000 --> 00:02:11,000
119
+ object.
120
+
121
+ 31
122
+ 00:02:12,000 --> 00:02:19,000
123
+ This also simplify life of developers, restricts the access of a table so that nobody can insert zeros
124
+
125
+ 32
126
+ 00:02:19,000 --> 00:02:23,000
127
+ into the table is every single year so far.
128
+
129
+ 33
130
+ 00:02:23,000 --> 00:02:30,000
131
+ Let's look at examples who you watched previous lessons because in this lesson, we're going to use
132
+
133
+ 34
134
+ 00:02:30,000 --> 00:02:33,000
135
+ tables that were created during the course.
136
+
137
+ 35
138
+ 00:02:33,000 --> 00:02:37,000
139
+ We're going to create value with you and configure it for our needs.
140
+
141
+ 36
142
+ 00:02:38,000 --> 00:02:44,000
143
+ We'll create a view from my school workbench, I'm going to show you sequel queries it will create for
144
+
145
+ 37
146
+ 00:02:44,000 --> 00:02:52,000
147
+ you, for us just to remind you, we have two tables here user table and roll table here.
148
+
149
+ 38
150
+ 00:02:52,000 --> 00:02:58,000
151
+ How's it look like this great view with user email and droll name?
152
+
153
+ 39
154
+ 00:02:58,000 --> 00:03:04,000
155
+ Because this is a dataset I use most often in my app urines and log in.
156
+
157
+ 40
158
+ 00:03:04,000 --> 00:03:10,000
159
+ I use user email and also I need to understand user role to use this information for further interaction
160
+
161
+ 41
162
+ 00:03:10,000 --> 00:03:12,000
163
+ inside our app.
164
+
165
+ 42
166
+ 00:03:12,000 --> 00:03:19,000
167
+ That's why it might be a good year for me to create this view and simplify life of developers to let
168
+
169
+ 43
170
+ 00:03:19,000 --> 00:03:19,000
171
+ them.
172
+
173
+ 44
174
+ 00:03:19,000 --> 00:03:23,000
175
+ Where is this for you directly instead of creation on Junqueras?
176
+
177
+ 45
178
+ 00:03:24,000 --> 00:03:29,000
179
+ And I believe you understood that this is a simple example was two tables only.
180
+
181
+ 46
182
+ 00:03:29,000 --> 00:03:37,000
183
+ But in real life, you might create tables that use junk, whereas the five or even more tables, we
184
+
185
+ 47
186
+ 00:03:37,000 --> 00:03:44,000
187
+ are going to start simple and let's create this view for two attributes from the tables.
188
+
189
+ 48
190
+ 00:03:45,000 --> 00:03:50,000
191
+ The grades have you in my school workbench, I can click on the Create View icon.
192
+
193
+ 49
194
+ 00:03:50,000 --> 00:03:57,000
195
+ Technically speaking, my school workbench just help us was one learn or create you statement and after
196
+
197
+ 50
198
+ 00:03:57,000 --> 00:04:01,000
199
+ --, we need to specify sequel query for all of you.
200
+
201
+ 51
202
+ 00:04:02,000 --> 00:04:06,000
203
+ I click Apply button and I execute this query.
204
+
205
+ 52
206
+ 00:04:06,000 --> 00:04:12,000
207
+ Now the great I love you and you can find it here and the use in my school workbench.
208
+
209
+ 53
210
+ 00:04:13,000 --> 00:04:20,000
211
+ Basically, you can perform select operations against this view is the same as you do against a table
212
+
213
+ 54
214
+ 00:04:21,000 --> 00:04:22,000
215
+ in select statement.
216
+
217
+ 55
218
+ 00:04:22,000 --> 00:04:24,000
219
+ You just use your name.
220
+
221
+ 56
222
+ 00:04:25,000 --> 00:04:27,000
223
+ Let me now update our regional tables.
224
+
225
+ 57
226
+ 00:04:28,000 --> 00:04:33,000
227
+ For example, let's paste one more record in user table was role assigned.
228
+
229
+ 58
230
+ 00:04:36,000 --> 00:04:42,000
231
+ One rule is that it lets execute, select all query to our view one more time.
232
+
233
+ 59
234
+ 00:04:43,000 --> 00:04:45,000
235
+ And you can see that view is also updated.
236
+
237
+ 60
238
+ 00:04:46,000 --> 00:04:47,000
239
+ Isn't that cool?
240
+
241
+ 61
242
+ 00:04:48,000 --> 00:04:50,000
243
+ And you don't need to constantly read joint statements.
244
+
245
+ 62
246
+ 00:04:51,000 --> 00:04:55,000
247
+ Pay attention that I can't add new rules here in view.
248
+
249
+ 63
250
+ 00:04:55,000 --> 00:05:00,000
251
+ So as we discussed, we often use views for select statements.
252
+
253
+ 64
254
+ 00:05:01,000 --> 00:05:03,000
255
+ That's all what I wanted to share with you regarding the use.
256
+
257
+ 65
258
+ 00:05:04,000 --> 00:05:05,000
259
+ Is it clear?
260
+
261
+ 66
262
+ 00:05:06,000 --> 00:05:12,000
263
+ Even in the case you have any questions, please add them in comments below this video, and I will
264
+
265
+ 67
266
+ 00:05:12,000 --> 00:05:13,000
267
+ be happy to answer.
268
+
269
+ 68
270
+ 00:05:14,000 --> 00:05:16,000
271
+ Let's proceed with a new topic.
272
+
273
+ 69
274
+ 00:05:17,000 --> 00:05:24,000
275
+ That's what triggers are and how we can use them, and trigger is a set of instructions that are automatically
276
+
277
+ 70
278
+ 00:05:24,000 --> 00:05:30,000
279
+ activated in response to a specific event occurred on a table in the database.
280
+
281
+ 71
282
+ 00:05:30,000 --> 00:05:34,000
283
+ The trigger is always associated with a particular table.
284
+
285
+ 72
286
+ 00:05:34,000 --> 00:05:39,000
287
+ If the table is deleted, all the associated triggers are also deleted automatically.
288
+
289
+ 73
290
+ 00:05:40,000 --> 00:05:49,000
291
+ The trigger is invoked either before or after the following event insert when a euro is inserted hamdard
292
+
293
+ 74
294
+ 00:05:49,000 --> 00:05:51,000
295
+ when an existing row is updated.
296
+
297
+ 75
298
+ 00:05:51,000 --> 00:05:54,000
299
+ Delete when the row is deleted.
300
+
301
+ 76
302
+ 00:05:54,000 --> 00:05:58,000
303
+ When you submit for execution and insert, update or delete statement.
304
+
305
+ 77
306
+ 00:05:59,000 --> 00:06:05,000
307
+ Zero Relational Database Management System FAS as a corresponding trigger, always remember is that
308
+
309
+ 78
310
+ 00:06:05,000 --> 00:06:11,000
311
+ it can be two triggers with similar action time and event for one table.
312
+
313
+ 79
314
+ 00:06:12,000 --> 00:06:20,000
315
+ For example, we can't have two before update triggers for a table, but we can have before update and
316
+
317
+ 80
318
+ 00:06:20,000 --> 00:06:28,000
319
+ before insert trigger or before and after they trigger, let's review the structure of the Create Trigger
320
+
321
+ 81
322
+ 00:06:28,000 --> 00:06:34,000
323
+ statement we write Great trigger first trigger name should be unique.
324
+
325
+ 82
326
+ 00:06:34,000 --> 00:06:40,000
327
+ After that, we specify, was a trigger should be activated before or after some event occurs.
328
+
329
+ 83
330
+ 00:06:41,000 --> 00:06:45,000
331
+ Then we need to specify on which event we want to activate.
332
+
333
+ 84
334
+ 00:06:45,000 --> 00:06:51,000
335
+ Our instructions is insert the date or the lead in which table.
336
+
337
+ 85
338
+ 00:06:51,000 --> 00:06:54,000
339
+ After that, we can specify for each role.
340
+
341
+ 86
342
+ 00:06:55,000 --> 00:06:57,000
343
+ This specifies a role level trigger.
344
+
345
+ 87
346
+ 00:06:58,000 --> 00:07:02,000
347
+ For example, the trigger will be executed for each role being affected.
348
+
349
+ 88
350
+ 00:07:03,000 --> 00:07:05,000
351
+ We can add trigger order.
352
+
353
+ 89
354
+ 00:07:05,000 --> 00:07:12,000
355
+ This option might be useful if we have chain of triggers and we need to control that order.
356
+
357
+ 90
358
+ 00:07:12,000 --> 00:07:19,000
359
+ And after all this, we need to describe trigger body that is exactly a set of instructions that are
360
+
361
+ 91
362
+ 00:07:19,000 --> 00:07:20,000
363
+ needed to be executed.
364
+
365
+ 92
366
+ 00:07:21,000 --> 00:07:22,000
367
+ Is everything clear?
368
+
369
+ 93
370
+ 00:07:22,000 --> 00:07:27,000
371
+ Let's look at our practical demo and create one trigger as an example.
372
+
373
+ 94
374
+ 00:07:28,000 --> 00:07:35,000
375
+ We are going to come up with some imaginary business case, imagine before inserting new actors in user
376
+
377
+ 95
378
+ 00:07:35,000 --> 00:07:35,000
379
+ table.
380
+
381
+ 96
382
+ 00:07:35,000 --> 00:07:42,000
383
+ We want to check that in case there is no well specified for foreign key F-k user role, fields should
384
+
385
+ 97
386
+ 00:07:42,000 --> 00:07:44,000
387
+ be populated in this valley.
388
+
389
+ 98
390
+ 00:07:44,000 --> 00:07:44,000
391
+ Six.
392
+
393
+ 99
394
+ 00:07:45,000 --> 00:07:49,000
395
+ Yes, I know that for such purpose, we can set up default value for field.
396
+
397
+ 100
398
+ 00:07:50,000 --> 00:07:56,000
399
+ But I want you to focus on the syntax right now, and I just want to present your syntax as simple as
400
+
401
+ 101
402
+ 00:07:56,000 --> 00:08:00,000
403
+ possible without overcomplicate and business logic.
404
+
405
+ 102
406
+ 00:08:00,000 --> 00:08:08,000
407
+ So attention to the syntax and my comments as we go, there is one more syntax specifics.
408
+
409
+ 103
410
+ 00:08:09,000 --> 00:08:13,000
411
+ You can see that I specified another the name of the double ampersand.
412
+
413
+ 104
414
+ 00:08:14,000 --> 00:08:22,000
415
+ Usually, we use a semicolon to separate those statements when writing SQL statements and MySQL client
416
+
417
+ 105
418
+ 00:08:22,000 --> 00:08:29,000
419
+ program such as My SQL Revenge uses limited to separate statements and execute each statement separately.
420
+
421
+ 106
422
+ 00:08:30,000 --> 00:08:38,000
423
+ However, for example, a stored procedure or trigger consists of multiple statements separated by semicolon,
424
+
425
+ 107
426
+ 00:08:38,000 --> 00:08:45,000
427
+ and it will use my SQL workbench to define a trigger like in this case that contains semicolon characters.
428
+
429
+ 108
430
+ 00:08:46,000 --> 00:08:52,000
431
+ The most equal client program will not treat the whole stored procedure, create statement or the whole
432
+
433
+ 109
434
+ 00:08:52,000 --> 00:08:58,000
435
+ trigger create statement as a single statement, but many statements.
436
+
437
+ 110
438
+ 00:08:59,000 --> 00:09:05,000
439
+ Therefore, we must really finds that the limiter temporarily so that we can pause the whole trigger
440
+
441
+ 111
442
+ 00:09:05,000 --> 00:09:08,000
443
+ description to the server as a single statement.
444
+
445
+ 112
446
+ 00:09:09,000 --> 00:09:13,000
447
+ That's why I said You didn't DeMatha at the beginning of this statement.
448
+
449
+ 113
450
+ 00:09:13,000 --> 00:09:17,000
451
+ Andrew Chan it back to default at the end of the statement.
452
+
453
+ 114
454
+ 00:09:18,000 --> 00:09:23,000
455
+ Execute multiple statements which can place trigger body between Begin and and keywords.
456
+
457
+ 115
458
+ 00:09:24,000 --> 00:09:28,000
459
+ Basically, you can put here I'm a date insert delete statements.
460
+
461
+ 116
462
+ 00:09:28,000 --> 00:09:32,000
463
+ You can address those statements to any table you wish.
464
+
465
+ 117
466
+ 00:09:32,000 --> 00:09:41,000
467
+ And also, you can make conditions like I do here, I write, if followed by a predicate, some expressions,
468
+
469
+ 118
470
+ 00:09:41,000 --> 00:09:43,000
471
+ a three chance is a true or false.
472
+
473
+ 119
474
+ 00:09:43,000 --> 00:09:49,000
475
+ In this particular case, before inserting new value, I verifies its new value as it is going to be
476
+
477
+ 120
478
+ 00:09:49,000 --> 00:09:53,000
479
+ inserted is not within the trigger body.
480
+
481
+ 121
482
+ 00:09:53,000 --> 00:09:56,000
483
+ We can refer to columns in the subject table.
484
+
485
+ 122
486
+ 00:09:57,000 --> 00:10:02,000
487
+ That is the table associated with the trigger by using the aliases.
488
+
489
+ 123
490
+ 00:10:02,000 --> 00:10:11,000
491
+ Old and new art and column name refers to column often exists in the road before it is updated or deleted.
492
+
493
+ 124
494
+ 00:10:12,000 --> 00:10:19,000
495
+ You and column the very first is a column often, you know, to be inserted or an existing row after
496
+
497
+ 125
498
+ 00:10:19,000 --> 00:10:20,000
499
+ it is updated.
500
+
501
+ 126
502
+ 00:10:20,000 --> 00:10:21,000
503
+ Does it make sense?
504
+
505
+ 127
506
+ 00:10:22,000 --> 00:10:28,000
507
+ In the East Block, we can write any statements we wish, considering that we override the limit, that
508
+
509
+ 128
510
+ 00:10:28,000 --> 00:10:35,000
511
+ we can use semicolon here to separate statements between each other at the end of the statement, I
512
+
513
+ 129
514
+ 00:10:35,000 --> 00:10:37,000
515
+ should specify and if?
516
+
517
+ 130
518
+ 00:10:38,000 --> 00:10:44,000
519
+ Once I declared all statements and about it, I should close triggered by what it was and the keyword.
520
+
521
+ 131
522
+ 00:10:45,000 --> 00:10:49,000
523
+ And as we already discussed, I want to return the limits back to the fold.
524
+
525
+ 132
526
+ 00:10:50,000 --> 00:10:51,000
527
+ Let's execute the statement.
528
+
529
+ 133
530
+ 00:10:52,000 --> 00:10:58,000
531
+ And I see that query has been executed successfully and trigger is created.
532
+
533
+ 134
534
+ 00:10:59,000 --> 00:11:04,000
535
+ You can check all existing triggers and this is where my SQL workbench do mouse.
536
+
537
+ 135
538
+ 00:11:04,000 --> 00:11:08,000
539
+ Right click on the table and select out a table.
540
+
541
+ 136
542
+ 00:11:09,000 --> 00:11:14,000
543
+ And on the three year tab, you can find all existing triggers to delete trigger.
544
+
545
+ 137
546
+ 00:11:14,000 --> 00:11:18,000
547
+ You can click Mouse, right click and select Delete Trigger.
548
+
549
+ 138
550
+ 00:11:19,000 --> 00:11:25,000
551
+ You can move the order of triggers here if you have multiple triggers, duplicate triggers, if needed,
552
+
553
+ 139
554
+ 00:11:25,000 --> 00:11:25,000
555
+ and so on.
556
+
557
+ 140
558
+ 00:11:26,000 --> 00:11:28,000
559
+ Let's see how trigger works.
560
+
561
+ 141
562
+ 00:11:29,000 --> 00:11:34,000
563
+ So I add new records and deliberately leaving F-k user role at any time.
564
+
565
+ 142
566
+ 00:11:35,000 --> 00:11:43,000
567
+ Let me apply changes and after changes applied, you can see that six has been added by default.
568
+
569
+ 143
570
+ 00:11:43,000 --> 00:11:51,000
571
+ So before insertion, my triggers set the value to zero records is that I was about to act and only
572
+
573
+ 144
574
+ 00:11:51,000 --> 00:11:56,000
575
+ after that insertion happened and I received a result like this.
576
+
577
+ 145
578
+ 00:11:57,000 --> 00:12:03,000
579
+ In conclusion of triggers discussion, it is worth to mention some drawbacks of using triggers.
580
+
581
+ 146
582
+ 00:12:04,000 --> 00:12:08,000
583
+ The main problem with triggers are they are completely global.
584
+
585
+ 147
586
+ 00:12:08,000 --> 00:12:16,000
587
+ If you create a trigger to react on insertion event, that means that this rule will be applied to any
588
+
589
+ 148
590
+ 00:12:16,000 --> 00:12:19,000
591
+ kind of insertion event without possibility.
592
+
593
+ 149
594
+ 00:12:19,000 --> 00:12:24,000
595
+ Make an exclusion, at least sometimes logic on that the base layer.
596
+
597
+ 150
598
+ 00:12:24,000 --> 00:12:32,000
599
+ Remember that creating triggers on the database layer you want your logic, the specific database and
600
+
601
+ 151
602
+ 00:12:32,000 --> 00:12:36,000
603
+ then some degree detach your business logic from your app.
604
+
605
+ 152
606
+ 00:12:37,000 --> 00:12:44,000
607
+ While triggers not always contain business rules and may be important piece in supporting of data consistency
608
+
609
+ 153
610
+ 00:12:44,000 --> 00:12:44,000
611
+ database.
612
+
613
+ 154
614
+ 00:12:45,000 --> 00:12:51,000
615
+ This is not always the case, and in case you make decisions, migrate to another database management
616
+
617
+ 155
618
+ 00:12:51,000 --> 00:12:52,000
619
+ system.
620
+
621
+ 156
622
+ 00:12:52,000 --> 00:12:56,000
623
+ It may become a pain to not lose any important operation.
624
+
625
+ 157
626
+ 00:12:56,000 --> 00:12:59,000
627
+ Already scrapped and triggers triggers.
628
+
629
+ 158
630
+ 00:12:59,000 --> 00:13:02,000
631
+ I still see by saying this.
632
+
633
+ 159
634
+ 00:13:02,000 --> 00:13:09,000
635
+ I mean that it is easy to forget that there until they hurt you with unintended and very mysterious
636
+
637
+ 160
638
+ 00:13:09,000 --> 00:13:10,000
639
+ consequences.
640
+
641
+ 161
642
+ 00:13:11,000 --> 00:13:14,000
643
+ All this doesn't mean that you should never use triggers.
644
+
645
+ 162
646
+ 00:13:14,000 --> 00:13:21,000
647
+ You just need to be aware of about this potential impact and use triggers carefully and wisely.
648
+
649
+ 163
650
+ 00:13:22,000 --> 00:13:25,000
651
+ If everything is clear, let's move on.
652
+
653
+ 164
654
+ 00:13:26,000 --> 00:13:28,000
655
+ Now, let's talk about stored procedures.
656
+
657
+ 165
658
+ 00:13:29,000 --> 00:13:32,000
659
+ Let's learn what are they and how to work with them.
660
+
661
+ 166
662
+ 00:13:33,000 --> 00:13:37,000
663
+ The start of procedure is a prepared sequel code is that you can see.
664
+
665
+ 167
666
+ 00:13:37,000 --> 00:13:40,000
667
+ So the court can be reused over and over again.
668
+
669
+ 168
670
+ 00:13:41,000 --> 00:13:49,000
671
+ So if you have an equal query that you write over and over again, save it as a stored procedure and
672
+
673
+ 169
674
+ 00:13:49,000 --> 00:13:51,000
675
+ then just call it to execute it.
676
+
677
+ 170
678
+ 00:13:52,000 --> 00:13:59,000
679
+ You can also put parameters to this procedure so that the procedure can act based on the parameter values
680
+
681
+ 171
682
+ 00:13:59,000 --> 00:14:00,000
683
+ is at a sparse.
684
+
685
+ 172
686
+ 00:14:01,000 --> 00:14:05,000
687
+ So what advantages of storage procedures performance?
688
+
689
+ 173
690
+ 00:14:06,000 --> 00:14:13,000
691
+ The SQL server stored procedure when executed for the first time, creates a plan and stores it in the
692
+
693
+ 174
694
+ 00:14:13,000 --> 00:14:18,000
695
+ buffer pool so that plan can be reused when it executes next time.
696
+
697
+ 175
698
+ 00:14:19,000 --> 00:14:25,000
699
+ Reusable storage procedures can be executed by multiple users or multiple client applications without
700
+
701
+ 176
702
+ 00:14:25,000 --> 00:14:27,000
703
+ the need of writing the code again.
704
+
705
+ 177
706
+ 00:14:28,000 --> 00:14:30,000
707
+ It can be easily modified.
708
+
709
+ 178
710
+ 00:14:30,000 --> 00:14:37,000
711
+ We can easily modify the code inside the stored procedure without the need to restart or deploying the
712
+
713
+ 179
714
+ 00:14:37,000 --> 00:14:39,000
715
+ application security.
716
+
717
+ 180
718
+ 00:14:40,000 --> 00:14:45,000
719
+ Stored procedures reduce this threat by eliminating direct access to the tables.
720
+
721
+ 181
722
+ 00:14:46,000 --> 00:14:53,000
723
+ We can also encrypt the storage procedures while creating them so that source code and signs are stored.
724
+
725
+ 182
726
+ 00:14:53,000 --> 00:14:54,000
727
+ Procedures not visible.
728
+
729
+ 183
730
+ 00:14:55,000 --> 00:14:57,000
731
+ Reduced network traffic.
732
+
733
+ 184
734
+ 00:14:58,000 --> 00:15:04,000
735
+ One When we use stored procedures instead of writing SQL queries as the application level only has a
736
+
737
+ 185
738
+ 00:15:04,000 --> 00:15:08,000
739
+ procedure, name is passed over the network instead of the whole cycle code.
740
+
741
+ 186
742
+ 00:15:09,000 --> 00:15:13,000
743
+ In of procedures, we can pass in and out parameters.
744
+
745
+ 187
746
+ 00:15:14,000 --> 00:15:18,000
747
+ There are three types of parameters that we can pass and start procedures.
748
+
749
+ 188
750
+ 00:15:18,000 --> 00:15:27,000
751
+ They are in, out and in, out in is an input only parameters which provide values to the storage procedure.
752
+
753
+ 189
754
+ 00:15:28,000 --> 00:15:31,000
755
+ In addition, the value of in parameter is protected.
756
+
757
+ 190
758
+ 00:15:32,000 --> 00:15:39,000
759
+ It means that even if you change the value of the parameter inside the stored procedure, its original
760
+
761
+ 191
762
+ 00:15:39,000 --> 00:15:43,000
763
+ value is unchanged after the procedure ends.
764
+
765
+ 192
766
+ 00:15:44,000 --> 00:15:52,000
767
+ In other words, the third procedure only works on the copy of in parameter and in parameter processing
768
+
769
+ 193
770
+ 00:15:52,000 --> 00:15:52,000
771
+ value.
772
+
773
+ 194
774
+ 00:15:52,000 --> 00:15:59,000
775
+ In the procedure, the procedure might modify the value, but the modification is not visible to the
776
+
777
+ 195
778
+ 00:15:59,000 --> 00:16:02,000
779
+ caller when the procedure returns.
780
+
781
+ 196
782
+ 00:16:03,000 --> 00:16:10,000
783
+ Out is output only parameters, which return values from this procedure, there's a Call-In program,
784
+
785
+ 197
786
+ 00:16:11,000 --> 00:16:18,000
787
+ the value of an out parameter can be changed inside the stored procedure, and its new value is passed
788
+
789
+ 198
790
+ 00:16:18,000 --> 00:16:25,000
791
+ back to IT program an out parameter processing value from the procedure back to the collar.
792
+
793
+ 199
794
+ 00:16:25,000 --> 00:16:31,000
795
+ Its initial value is not within the procedure and its value is usable to the collar.
796
+
797
+ 200
798
+ 00:16:31,000 --> 00:16:34,000
799
+ Was the procedure a chance you now?
800
+
801
+ 201
802
+ 00:16:34,000 --> 00:16:42,000
803
+ It is an input and output parameters which provides values to and returns values from the stored procedure.
804
+
805
+ 202
806
+ 00:16:43,000 --> 00:16:46,000
807
+ This is a combination of in and out parameters.
808
+
809
+ 203
810
+ 00:16:46,000 --> 00:16:53,000
811
+ It means that the Coghlin program may cost the argument, and the stored procedure can modify the invalid
812
+
813
+ 204
814
+ 00:16:53,000 --> 00:17:00,000
815
+ parameter and pass the new value back to the Collins program and out parameter is initialized by the
816
+
817
+ 205
818
+ 00:17:00,000 --> 00:17:07,000
819
+ collar can be modified by the procedure, and any change made by the procedure is visible to the caller.
820
+
821
+ 206
822
+ 00:17:08,000 --> 00:17:16,000
823
+ Once the procedure returns for each out or in that parameter, boss a user defined variable in the call
824
+
825
+ 207
826
+ 00:17:16,000 --> 00:17:23,000
827
+ statement that involves the procedure so that you can obtain its value once the procedure returns.
828
+
829
+ 208
830
+ 00:17:23,000 --> 00:17:30,000
831
+ If you are calling the procedure from within and not the stored procedure function, you can also pass
832
+
833
+ 209
834
+ 00:17:30,000 --> 00:17:35,000
835
+ a routine parameter or local routine variable as an out or an out parameter.
836
+
837
+ 210
838
+ 00:17:36,000 --> 00:17:42,000
839
+ If you are calling the procedure from within a trigger, you can also pass new column name as an out
840
+
841
+ 211
842
+ 00:17:42,000 --> 00:17:44,000
843
+ or in that parameter.
844
+
845
+ 212
846
+ 00:17:44,000 --> 00:17:50,000
847
+ The parameter leased and close was in parentheses must always be present.
848
+
849
+ 213
850
+ 00:17:50,000 --> 00:17:57,000
851
+ If there are no parameters and empty parameters, at least should be used, parameter names are not
852
+
853
+ 214
854
+ 00:17:57,000 --> 00:17:58,000
855
+ case sensitive.
856
+
857
+ 215
858
+ 00:17:59,000 --> 00:18:04,000
859
+ Each parameter is an in parameter by default to specify otherwise for a parameter.
860
+
861
+ 216
862
+ 00:18:04,000 --> 00:18:08,000
863
+ Use the keywords out or in out before the parameter name.
864
+
865
+ 217
866
+ 00:18:09,000 --> 00:18:15,000
867
+ Don't worry if you are not feeling confident about understanding of different parameter types, we are
868
+
869
+ 218
870
+ 00:18:15,000 --> 00:18:21,000
871
+ going to have them soon and it will be easier to understand was examples if you understood the theory
872
+
873
+ 219
874
+ 00:18:21,000 --> 00:18:24,000
875
+ of stored procedures and why we need them.
876
+
877
+ 220
878
+ 00:18:24,000 --> 00:18:26,000
879
+ Let's hold a demo.
880
+
881
+ 221
882
+ 00:18:27,000 --> 00:18:29,000
883
+ Let's create a simple procedure.
884
+
885
+ 222
886
+ 00:18:29,000 --> 00:18:32,000
887
+ Our procedure will select the user by email.
888
+
889
+ 223
890
+ 00:18:32,000 --> 00:18:36,000
891
+ You already know why I set different animals are in my school query.
892
+
893
+ 224
894
+ 00:18:37,000 --> 00:18:40,000
895
+ The reason is the same as an example with triggers.
896
+
897
+ 225
898
+ 00:18:41,000 --> 00:18:43,000
899
+ Here's an example was in parameter.
900
+
901
+ 226
902
+ 00:18:44,000 --> 00:18:51,000
903
+ Important thing to remember Bear tensions at the name of the parameter and name of column in where clause
904
+
905
+ 227
906
+ 00:18:51,000 --> 00:18:52,000
907
+ should be different.
908
+
909
+ 228
910
+ 00:18:52,000 --> 00:18:59,000
911
+ You know, the server would understand where you referred the parameter and where you refer to the column.
912
+
913
+ 229
914
+ 00:19:00,000 --> 00:19:06,000
915
+ After that, I right begin keywords and after that go start procedure body.
916
+
917
+ 230
918
+ 00:19:06,000 --> 00:19:08,000
919
+ Well, we can specify our instructions.
920
+
921
+ 231
922
+ 00:19:09,000 --> 00:19:11,000
923
+ One procedure body is finished.
924
+
925
+ 232
926
+ 00:19:11,000 --> 00:19:13,000
927
+ We use and keywords.
928
+
929
+ 233
930
+ 00:19:16,000 --> 00:19:24,000
931
+ Now we can easily execute this stored procedure with the help of coal keywords and possibly the email
932
+
933
+ 234
934
+ 00:19:24,000 --> 00:19:28,000
935
+ parameter in case we wouldn't pass email parameter.
936
+
937
+ 235
938
+ 00:19:28,000 --> 00:19:33,000
939
+ We would see error that would tell us about wrong number of parameters.
940
+
941
+ 236
942
+ 00:19:34,000 --> 00:19:38,000
943
+ And here is record with the correct email has been returned.
944
+
945
+ 237
946
+ 00:19:38,000 --> 00:19:41,000
947
+ Do understand how to create stored procedure and how to call it.
948
+
949
+ 238
950
+ 00:19:42,000 --> 00:19:48,000
951
+ As you can see, there is nothing complex in this, but probably a few questions still in the eye at
952
+
953
+ 239
954
+ 00:19:48,000 --> 00:19:51,000
955
+ how the work was out and in parameters.
956
+
957
+ 240
958
+ 00:19:51,000 --> 00:19:52,000
959
+ Correct.
960
+
961
+ 241
962
+ 00:19:53,000 --> 00:19:53,000
963
+ As I promised you.
964
+
965
+ 242
966
+ 00:19:54,000 --> 00:19:57,000
967
+ Let me show a practical example with these types of parameters.
968
+
969
+ 243
970
+ 00:19:58,000 --> 00:20:04,000
971
+ Let's create procedure now that will return us average amount of money in our parameter.
972
+
973
+ 244
974
+ 00:20:04,000 --> 00:20:08,000
975
+ As you can see, I vividly specifies that this is out parameter.
976
+
977
+ 245
978
+ 00:20:09,000 --> 00:20:17,000
979
+ And after that inside procedure, I use into key words to stores the result into the out parameter.
980
+
981
+ 246
982
+ 00:20:18,000 --> 00:20:18,000
983
+ Is that clear?
984
+
985
+ 247
986
+ 00:20:19,000 --> 00:20:21,000
987
+ You should be familiar with this query.
988
+
989
+ 248
990
+ 00:20:22,000 --> 00:20:25,000
991
+ This is aggregate functions that you reviewed in a separate lesson.
992
+
993
+ 249
994
+ 00:20:26,000 --> 00:20:32,000
995
+ So in case you want to learn more about average and aggregate functions, feel free to review previous
996
+
997
+ 250
998
+ 00:20:32,000 --> 00:20:36,000
999
+ lessons in the same way we create this stored procedure.
1000
+
1001
+ 251
1002
+ 00:20:37,000 --> 00:20:43,000
1003
+ And now let's learn what is different during the invocation of this stored procedure when we call our
1004
+
1005
+ 252
1006
+ 00:20:43,000 --> 00:20:44,000
1007
+ stored procedure.
1008
+
1009
+ 253
1010
+ 00:20:45,000 --> 00:20:53,000
1011
+ We pass so-called session variable as a parameter to receive returns value because we need that reference
1012
+
1013
+ 254
1014
+ 00:20:53,000 --> 00:20:56,000
1015
+ to the variable to retrieve a result of a storage procedure.
1016
+
1017
+ 255
1018
+ 00:20:56,000 --> 00:21:04,000
1019
+ Execution A session variable is a user defined variables that starts was at sine doesn't require declaration
1020
+
1021
+ 256
1022
+ 00:21:05,000 --> 00:21:12,000
1023
+ can be used in any SQL query or statement non-visible to other sessions and exists until the end of
1024
+
1025
+ 257
1026
+ 00:21:12,000 --> 00:21:13,000
1027
+ the current session.
1028
+
1029
+ 258
1030
+ 00:21:14,000 --> 00:21:19,000
1031
+ And after that, we can refer to this variable to get the value that was recorded into it.
1032
+
1033
+ 259
1034
+ 00:21:20,000 --> 00:21:23,000
1035
+ I use simple select statement Does it make sense?
1036
+
1037
+ 260
1038
+ 00:21:24,000 --> 00:21:26,000
1039
+ Is it not clear now home?
1040
+
1041
+ 261
1042
+ 00:21:26,000 --> 00:21:27,000
1043
+ That was this example.
1044
+
1045
+ 262
1046
+ 00:21:27,000 --> 00:21:30,000
1047
+ It is not clear how to use our parameter.
1048
+
1049
+ 263
1050
+ 00:21:31,000 --> 00:21:34,000
1051
+ It looks like I have one more parameter type to show.
1052
+
1053
+ 264
1054
+ 00:21:35,000 --> 00:21:37,000
1055
+ Let me show you example of in-out parameter.
1056
+
1057
+ 265
1058
+ 00:21:38,000 --> 00:21:42,000
1059
+ In this example, we are going to implement counter stored procedure.
1060
+
1061
+ 266
1062
+ 00:21:43,000 --> 00:21:49,000
1063
+ This procedure will take input parameter, will increase it by the specified amount and will return
1064
+
1065
+ 267
1066
+ 00:21:49,000 --> 00:21:54,000
1067
+ as a value in the body of our stored procedure will incremento account.
1068
+
1069
+ 268
1070
+ 00:21:55,000 --> 00:21:56,000
1071
+ That's it.
1072
+
1073
+ 269
1074
+ 00:21:57,000 --> 00:22:04,000
1075
+ Let's look how we work with this kind of stored procedures and declare a session variable and initialize
1076
+
1077
+ 270
1078
+ 00:22:04,000 --> 00:22:05,000
1079
+ it with some value.
1080
+
1081
+ 271
1082
+ 00:22:06,000 --> 00:22:12,000
1083
+ After that, I call my stored procedure a few times by passing the same session variable and incremental
1084
+
1085
+ 272
1086
+ 00:22:12,000 --> 00:22:12,000
1087
+ value.
1088
+
1089
+ 273
1090
+ 00:22:13,000 --> 00:22:18,000
1091
+ After all this, I can read my session variable to find that it was incremented.
1092
+
1093
+ 274
1094
+ 00:22:19,000 --> 00:22:25,000
1095
+ That proves that the state of our counter session variable was modified multiple times is every single
1096
+
1097
+ 275
1098
+ 00:22:25,000 --> 00:22:26,000
1099
+ year.
1100
+
1101
+ 276
1102
+ 00:22:26,000 --> 00:22:33,000
1103
+ And by the way, I have never shown you before how to request comments in my school robberies is just
1104
+
1105
+ 277
1106
+ 00:22:33,000 --> 00:22:38,000
1107
+ below neat in this the different types of comments that you can use in my school.
1108
+
1109
+ 278
1110
+ 00:22:39,000 --> 00:22:42,000
1111
+ First kind of comments that you can see here is double dash.
1112
+
1113
+ 279
1114
+ 00:22:42,000 --> 00:22:45,000
1115
+ The comments must be at the end of a line.
1116
+
1117
+ 280
1118
+ 00:22:45,000 --> 00:22:49,000
1119
+ Your SQL statement was a line break off the list.
1120
+
1121
+ 281
1122
+ 00:22:49,000 --> 00:22:56,000
1123
+ Mazeltov comment and can only span a single line was in your school statement and must be at the end
1124
+
1125
+ 282
1126
+ 00:22:56,000 --> 00:22:57,000
1127
+ of the line.
1128
+
1129
+ 283
1130
+ 00:22:58,000 --> 00:23:01,000
1131
+ Another type of comment is similar to the previous one.
1132
+
1133
+ 284
1134
+ 00:23:01,000 --> 00:23:06,000
1135
+ Just one more syntax of a single line comment started with a no sign.
1136
+
1137
+ 285
1138
+ 00:23:07,000 --> 00:23:10,000
1139
+ Also, you can use Mutula in common in multi-line comment.
1140
+
1141
+ 286
1142
+ 00:23:10,000 --> 00:23:14,000
1143
+ You should specify where a comment is started and where it is finished.
1144
+
1145
+ 287
1146
+ 00:23:15,000 --> 00:23:22,000
1147
+ I'm not showing you how to alter and drop stored procedures because it is similar to dropping and altering
1148
+
1149
+ 288
1150
+ 00:23:22,000 --> 00:23:24,000
1151
+ other database objects.
1152
+
1153
+ 289
1154
+ 00:23:24,000 --> 00:23:28,000
1155
+ Just click mouse rightly constraint procedure that you are interested in.
1156
+
1157
+ 290
1158
+ 00:23:29,000 --> 00:23:32,000
1159
+ Well, that it's regarding this example.
1160
+
1161
+ 291
1162
+ 00:23:33,000 --> 00:23:38,000
1163
+ And now let's talk about functions and understand how they're different from stored procedures.
1164
+
1165
+ 292
1166
+ 00:23:39,000 --> 00:23:45,000
1167
+ A function in my school is a program that is used to perform an action such as complex calculations,
1168
+
1169
+ 293
1170
+ 00:23:46,000 --> 00:23:49,000
1171
+ for example, and returns the result of an action as a value.
1172
+
1173
+ 294
1174
+ 00:23:50,000 --> 00:23:52,000
1175
+ Does it look like something similar to you?
1176
+
1177
+ 295
1178
+ 00:23:53,000 --> 00:23:55,000
1179
+ Something what we have just discussed.
1180
+
1181
+ 296
1182
+ 00:23:56,000 --> 00:24:01,000
1183
+ You are not the only one who wants to understand the difference between stored procedure and functions
1184
+
1185
+ 297
1186
+ 00:24:01,000 --> 00:24:01,000
1187
+ and sequel.
1188
+
1189
+ 298
1190
+ 00:24:02,000 --> 00:24:06,000
1191
+ Wait for a minute, and I will explain in detail what exactly the difference is.
1192
+
1193
+ 299
1194
+ 00:24:07,000 --> 00:24:10,000
1195
+ There are two types of functions available in my sequel.
1196
+
1197
+ 300
1198
+ 00:24:11,000 --> 00:24:15,000
1199
+ They are system defined functions and user defined functions.
1200
+
1201
+ 301
1202
+ 00:24:16,000 --> 00:24:22,000
1203
+ We'll discuss system defined functions and a separate lesson, the function, which is defined by a
1204
+
1205
+ 302
1206
+ 00:24:22,000 --> 00:24:25,000
1207
+ user, is called a user defined function.
1208
+
1209
+ 303
1210
+ 00:24:26,000 --> 00:24:33,000
1211
+ My skill user defined functions may or may not have parameters at the optional, but it always returns
1212
+
1213
+ 304
1214
+ 00:24:33,000 --> 00:24:35,000
1215
+ a single value that is mandatory.
1216
+
1217
+ 305
1218
+ 00:24:36,000 --> 00:24:42,000
1219
+ The returned value which is returned by then my single function can be often an invalid.
1220
+
1221
+ 306
1222
+ 00:24:42,000 --> 00:24:45,000
1223
+ My SQL data type regarding parameters and function.
1224
+
1225
+ 307
1226
+ 00:24:46,000 --> 00:24:48,000
1227
+ Hammerson is much single isn't stored procedures.
1228
+
1229
+ 308
1230
+ 00:24:49,000 --> 00:24:56,000
1231
+ You don't have different types of parameters like E out or announce all parameters and functions registered
1232
+
1233
+ 309
1234
+ 00:24:56,000 --> 00:24:57,000
1235
+ as any parameters.
1236
+
1237
+ 310
1238
+ 00:24:58,000 --> 00:25:02,000
1239
+ Now let's review high level syntax of great function statement.
1240
+
1241
+ 311
1242
+ 00:25:02,000 --> 00:25:07,000
1243
+ First of all, specifies the name of the search function that you want to create after create function
1244
+
1245
+ 312
1246
+ 00:25:07,000 --> 00:25:08,000
1247
+ keywords.
1248
+
1249
+ 313
1250
+ 00:25:09,000 --> 00:25:15,000
1251
+ Secondly, list all parameters of the storage function inside the parentheses, followed by the function
1252
+
1253
+ 314
1254
+ 00:25:15,000 --> 00:25:15,000
1255
+ name.
1256
+
1257
+ 315
1258
+ 00:25:16,000 --> 00:25:21,000
1259
+ And as we have discussed by default, all parameters are the end parameters.
1260
+
1261
+ 316
1262
+ 00:25:21,000 --> 00:25:30,000
1263
+ We can't specify in, out or in that modifies the parameters such centered specifies the data type of
1264
+
1265
+ 317
1266
+ 00:25:30,000 --> 00:25:35,000
1267
+ the return value in the returns statement, which can be an invalid my school data type.
1268
+
1269
+ 318
1270
+ 00:25:36,000 --> 00:25:44,000
1271
+ Force specify if a function is deterministic or not, using such deterministic keyword and deterministic
1272
+
1273
+ 319
1274
+ 00:25:44,000 --> 00:25:50,000
1275
+ function always returns the same result for the same input parameters, whereas a non deterministic
1276
+
1277
+ 320
1278
+ 00:25:50,000 --> 00:25:54,000
1279
+ function returns different results for the same input parameters.
1280
+
1281
+ 321
1282
+ 00:25:55,000 --> 00:26:02,000
1283
+ If you don't use deterministic or not deterministic, my cycle uses are not deterministic option by
1284
+
1285
+ 322
1286
+ 00:26:02,000 --> 00:26:10,000
1287
+ default, fifths rides are caught in the body of the storage function in the begin and block inside
1288
+
1289
+ 323
1290
+ 00:26:10,000 --> 00:26:10,000
1291
+ them.
1292
+
1293
+ 324
1294
+ 00:26:10,000 --> 00:26:11,000
1295
+ What is section?
1296
+
1297
+ 325
1298
+ 00:26:11,000 --> 00:26:14,000
1299
+ You need to specify at least one return statement.
1300
+
1301
+ 326
1302
+ 00:26:14,000 --> 00:26:20,000
1303
+ Zero chance statements returns a value to the call and programs when there was a written statement is
1304
+
1305
+ 327
1306
+ 00:26:20,000 --> 00:26:21,000
1307
+ reached.
1308
+
1309
+ 328
1310
+ 00:26:21,000 --> 00:26:25,000
1311
+ Six Kusum of the storage function is terminated immediately.
1312
+
1313
+ 329
1314
+ 00:26:26,000 --> 00:26:31,000
1315
+ Let's look at the demo of functions now and after that will somes a difference.
1316
+
1317
+ 330
1318
+ 00:26:31,000 --> 00:26:31,000
1319
+ A step.
1320
+
1321
+ 331
1322
+ 00:26:32,000 --> 00:26:38,000
1323
+ And now example, let's create a function that can identify user status based on the amount of money
1324
+
1325
+ 332
1326
+ 00:26:38,000 --> 00:26:40,000
1327
+ he or she has.
1328
+
1329
+ 333
1330
+ 00:26:40,000 --> 00:26:43,000
1331
+ The function will take money as method argument.
1332
+
1333
+ 334
1334
+ 00:26:43,000 --> 00:26:46,000
1335
+ It will return the value of virtual data type.
1336
+
1337
+ 335
1338
+ 00:26:47,000 --> 00:26:49,000
1339
+ This is deterministic function.
1340
+
1341
+ 336
1342
+ 00:26:50,000 --> 00:26:56,000
1343
+ We declare a variable and dependent on the amount of money we initialize this variable with one or another
1344
+
1345
+ 337
1346
+ 00:26:56,000 --> 00:26:56,000
1347
+ value.
1348
+
1349
+ 338
1350
+ 00:26:57,000 --> 00:27:04,000
1351
+ And at the end of the function body, when returns of value is ever seen clear here, please press a
1352
+
1353
+ 339
1354
+ 00:27:04,000 --> 00:27:07,000
1355
+ pause if you want to look at all lines more thoroughly.
1356
+
1357
+ 340
1358
+ 00:27:08,000 --> 00:27:12,000
1359
+ We executed this SQL statement and we have a function created.
1360
+
1361
+ 341
1362
+ 00:27:13,000 --> 00:27:20,000
1363
+ You can easily list and review all functions that exist in the database, like this show function status
1364
+
1365
+ 342
1366
+ 00:27:21,000 --> 00:27:22,000
1367
+ and specifies the database.
1368
+
1369
+ 343
1370
+ 00:27:23,000 --> 00:27:27,000
1371
+ We can see that in our database, only one function is declared so far.
1372
+
1373
+ 344
1374
+ 00:27:28,000 --> 00:27:29,000
1375
+ Let's invoke it now.
1376
+
1377
+ 345
1378
+ 00:27:30,000 --> 00:27:36,000
1379
+ And you can already find one more difference between search function and storage procedure different
1380
+
1381
+ 346
1382
+ 00:27:36,000 --> 00:27:43,000
1383
+ from a stored procedure, you can use a stored function in SQL statements wherever an expression is
1384
+
1385
+ 347
1386
+ 00:27:43,000 --> 00:27:44,000
1387
+ used.
1388
+
1389
+ 348
1390
+ 00:27:44,000 --> 00:27:49,000
1391
+ This helps improve the readability and mental ability of the procedural code.
1392
+
1393
+ 349
1394
+ 00:27:50,000 --> 00:27:57,000
1395
+ In our example, I want to extract last name of user management and get the result of my function for
1396
+
1397
+ 350
1398
+ 00:27:57,000 --> 00:27:57,000
1399
+ each record.
1400
+
1401
+ 351
1402
+ 00:27:58,000 --> 00:28:02,000
1403
+ You can see that I invoke function here and post-money value to it.
1404
+
1405
+ 352
1406
+ 00:28:03,000 --> 00:28:04,000
1407
+ Let's see what we'll get.
1408
+
1409
+ 353
1410
+ 00:28:05,000 --> 00:28:09,000
1411
+ And you can see that as a result, we get what we expected.
1412
+
1413
+ 354
1414
+ 00:28:09,000 --> 00:28:15,000
1415
+ Function has been applied to each record and returns us correct status for each user.
1416
+
1417
+ 355
1418
+ 00:28:15,000 --> 00:28:16,000
1419
+ Then the stent.
1420
+
1421
+ 356
1422
+ 00:28:16,000 --> 00:28:19,000
1423
+ Now how to create and execute function.
1424
+
1425
+ 357
1426
+ 00:28:19,000 --> 00:28:21,000
1427
+ If yes, Zenith is great.
1428
+
1429
+ 358
1430
+ 00:28:22,000 --> 00:28:28,000
1431
+ Now, when you saw functions and stored procedures, let's summarize what the difference is between
1432
+
1433
+ 359
1434
+ 00:28:28,000 --> 00:28:28,000
1435
+ them.
1436
+
1437
+ 360
1438
+ 00:28:29,000 --> 00:28:33,000
1439
+ There are numerous differences between storage procedures and storage functions.
1440
+
1441
+ 361
1442
+ 00:28:34,000 --> 00:28:34,000
1443
+ That's true.
1444
+
1445
+ 362
1446
+ 00:28:34,000 --> 00:28:41,000
1447
+ Using important ones, the function must return the value, but in standard procedure, it is optional
1448
+
1449
+ 363
1450
+ 00:28:41,000 --> 00:28:42,000
1451
+ in the procedure.
1452
+
1453
+ 364
1454
+ 00:28:42,000 --> 00:28:48,000
1455
+ We can return zero or and various functions can have on the input parameters for it.
1456
+
1457
+ 365
1458
+ 00:28:49,000 --> 00:28:52,000
1459
+ Various procedures can have input or output parameters.
1460
+
1461
+ 366
1462
+ 00:28:53,000 --> 00:29:00,000
1463
+ Functions can be called from procedure, whereas procedures cannot be called from a function.
1464
+
1465
+ 367
1466
+ 00:29:01,000 --> 00:29:09,000
1467
+ The procedure allows select as well as insert update delete statements in it, whereas function allows
1468
+
1469
+ 368
1470
+ 00:29:09,000 --> 00:29:10,000
1471
+ only a select statement in it.
1472
+
1473
+ 369
1474
+ 00:29:11,000 --> 00:29:19,000
1475
+ Procedures can be utilized in a select statement, whereas function can be embedded in that select statement.
1476
+
1477
+ 370
1478
+ 00:29:19,000 --> 00:29:27,000
1479
+ Stored procedures can't be used in the sequel statements anywhere in the where having select section
1480
+
1481
+ 371
1482
+ 00:29:28,000 --> 00:29:35,000
1483
+ various function can be an exception can be handled by try catch block in the procedure, whereas try
1484
+
1485
+ 372
1486
+ 00:29:35,000 --> 00:29:38,000
1487
+ catch block can't be used in a function.
1488
+
1489
+ 373
1490
+ 00:29:39,000 --> 00:29:45,000
1491
+ We can use transactions in procedure, whereas we can't use transactions in function.
1492
+
1493
+ 374
1494
+ 00:29:46,000 --> 00:29:49,000
1495
+ I believe that we captured and review of the main differences.
1496
+
1497
+ 375
1498
+ 00:29:50,000 --> 00:29:52,000
1499
+ That's all for this lesson.
1500
+
1501
+ 376
1502
+ 00:29:52,000 --> 00:29:56,000
1503
+ Let's recap what we have learned in the video today.
1504
+
1505
+ 377
1506
+ 00:29:56,000 --> 00:29:58,000
1507
+ We have learned what views are.
1508
+
1509
+ 378
1510
+ 00:29:58,000 --> 00:30:02,000
1511
+ We created our custom views and based on our existing tables.
1512
+
1513
+ 379
1514
+ 00:30:02,000 --> 00:30:08,000
1515
+ I explained to you what triggers are now you know, how to create and work with stored procedures.
1516
+
1517
+ 380
1518
+ 00:30:09,000 --> 00:30:16,000
1519
+ As we reviewed the examples, we learned different types of comments in Sequel Dilemma during my SQL
1520
+
1521
+ 381
1522
+ 00:30:16,000 --> 00:30:17,000
1523
+ and session variables.
1524
+
1525
+ 382
1526
+ 00:30:18,000 --> 00:30:25,000
1527
+ At the end of the lesson, we have learned functions and we learnt differences between functions and
1528
+
1529
+ 383
1530
+ 00:30:25,000 --> 00:30:26,000
1531
+ stored procedures.
1532
+
1533
+ 384
1534
+ 00:30:26,000 --> 00:30:28,000
1535
+ That's all for today.
1536
+
1537
+ 385
1538
+ 00:30:28,000 --> 00:30:30,000
1539
+ Thanks a lot for your attention.
1540
+
1541
+ 386
1542
+ 00:30:30,000 --> 00:30:31,000
1543
+ Have a great day.
1544
+
1545
+ 387
1546
+ 00:30:31,000 --> 00:30:33,000
1547
+ See you in the next lesson.
1548
+
49 - Relational Databases (Advanced)/002 MySQL Workbench Administration_en.srt ADDED
@@ -0,0 +1,508 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:06,000 --> 00:00:06,000
3
+ Hello, Jim.
4
+
5
+ 2
6
+ 00:00:06,000 --> 00:00:09,000
7
+ In this lesson, we're going to learn database administration.
8
+
9
+ 3
10
+ 00:00:10,000 --> 00:00:15,000
11
+ We're going to learn how to configure users random necessary rights to perform actions and database
12
+
13
+ 4
14
+ 00:00:16,000 --> 00:00:21,000
15
+ how to track database performance, manage data expert and data inputs.
16
+
17
+ 5
18
+ 00:00:21,000 --> 00:00:27,000
19
+ Definitely, this lesson is going to be interesting and useful for you in this lesson.
20
+
21
+ 6
22
+ 00:00:27,000 --> 00:00:32,000
23
+ I'm going to do a lot of screen sharing on the example of my school workbench.
24
+
25
+ 7
26
+ 00:00:32,000 --> 00:00:39,000
27
+ I'm going to show you how easily you can perform such basic operations as data import expert, new user
28
+
29
+ 8
30
+ 00:00:39,000 --> 00:00:46,000
31
+ creation, configuring the and access for new account and track, or my SQL server performance.
32
+
33
+ 9
34
+ 00:00:46,000 --> 00:00:47,000
35
+ Let's stop.
36
+
37
+ 10
38
+ 00:00:47,000 --> 00:00:53,000
39
+ And as I already said today, we're going to have a lot of them examples on screen sharing.
40
+
41
+ 11
42
+ 00:00:53,000 --> 00:00:55,000
43
+ So let me start sharing my screen.
44
+
45
+ 12
46
+ 00:00:56,000 --> 00:00:59,000
47
+ Let's start from learning data expert and data input.
48
+
49
+ 13
50
+ 00:01:00,000 --> 00:01:06,000
51
+ First of all, I want to show you a few menus and apps in my school workbench here, where for administration
52
+
53
+ 14
54
+ 00:01:06,000 --> 00:01:12,000
55
+ tap and under management section, you can find data experts and data options.
56
+
57
+ 15
58
+ 00:01:13,000 --> 00:01:18,000
59
+ Also, you can click on several menu to find data expert and data in-person options.
60
+
61
+ 16
62
+ 00:01:18,000 --> 00:01:19,000
63
+ Why we need this.
64
+
65
+ 17
66
+ 00:01:20,000 --> 00:01:26,000
67
+ For example, you need to configure a local database and populated with necessary data from production
68
+
69
+ 18
70
+ 00:01:26,000 --> 00:01:27,000
71
+ environments.
72
+
73
+ 19
74
+ 00:01:28,000 --> 00:01:31,000
75
+ These are for local development, debugging or any other purpose.
76
+
77
+ 20
78
+ 00:01:32,000 --> 00:01:40,000
79
+ You do data experts in one place and do data in court in your local database, or imagine that you developed
80
+
81
+ 21
82
+ 00:01:40,000 --> 00:01:43,000
83
+ your app and create a database structure.
84
+
85
+ 22
86
+ 00:01:43,000 --> 00:01:47,000
87
+ And now it is time to go live and move to a production environment.
88
+
89
+ 23
90
+ 00:01:48,000 --> 00:01:54,000
91
+ And as an example, let's imagine that we need to do experts of our learning database and all datasets
92
+
93
+ 24
94
+ 00:01:54,000 --> 00:01:56,000
95
+ we created during the previous lessons.
96
+
97
+ 25
98
+ 00:01:57,000 --> 00:02:00,000
99
+ Data expert I need to select database.
100
+
101
+ 26
102
+ 00:02:01,000 --> 00:02:04,000
103
+ And when I select a database, I can select tables that I want to export.
104
+
105
+ 27
106
+ 00:02:05,000 --> 00:02:12,000
107
+ Now, pay attention here if I want to initialize my database and production firm, and I don't need
108
+
109
+ 28
110
+ 00:02:12,000 --> 00:02:13,000
111
+ test data at all.
112
+
113
+ 29
114
+ 00:02:14,000 --> 00:02:15,000
115
+ I have few options here.
116
+
117
+ 30
118
+ 00:02:16,000 --> 00:02:22,000
119
+ Namely, I can dump structure only if you need both data and structure.
120
+
121
+ 31
122
+ 00:02:23,000 --> 00:02:27,000
123
+ You can select the option that will tell my school to dump data and structure.
124
+
125
+ 32
126
+ 00:02:28,000 --> 00:02:35,000
127
+ Below, you can find check boxes that allow you to indicate whether you are ready to export stored procedures,
128
+
129
+ 33
130
+ 00:02:35,000 --> 00:02:37,000
131
+ functions, triggers, events.
132
+
133
+ 34
134
+ 00:02:38,000 --> 00:02:44,000
135
+ Below, you can find check boxes that allow you to indicate whether you want to export stored procedures.
136
+
137
+ 35
138
+ 00:02:44,000 --> 00:02:48,000
139
+ Functions triggers events in exports options.
140
+
141
+ 36
142
+ 00:02:48,000 --> 00:02:54,000
143
+ You can specify Project Folder for the dump in case you would specify Project Folder.
144
+
145
+ 37
146
+ 00:02:54,000 --> 00:03:01,000
147
+ Each table will be exported as a separate file in case you select export self-contained file.
148
+
149
+ 38
150
+ 00:03:01,000 --> 00:03:05,000
151
+ All instructions will be export that single file.
152
+
153
+ 39
154
+ 00:03:05,000 --> 00:03:09,000
155
+ Pay attention that on my screen and probably on your stoop.
156
+
157
+ 40
158
+ 00:03:10,000 --> 00:03:13,000
159
+ It is not possible to investigate all possible configurations.
160
+
161
+ 41
162
+ 00:03:14,000 --> 00:03:19,000
163
+ Just resize widgets like I do here to see all menus and buttons.
164
+
165
+ 42
166
+ 00:03:20,000 --> 00:03:26,000
167
+ You can enable creation of dump in a single transaction and include create schema to.
168
+
169
+ 43
170
+ 00:03:27,000 --> 00:03:34,000
171
+ After you configure, it's everything you need, just click Start Export button after exports is finished.
172
+
173
+ 44
174
+ 00:03:34,000 --> 00:03:40,000
175
+ You can find the results of your exports is a destination that has been configured as a result of the
176
+
177
+ 45
178
+ 00:03:40,000 --> 00:03:48,000
179
+ export is nothing more than sequel instructions that create database abuse and insert waiting tables
180
+
181
+ 46
182
+ 00:03:48,000 --> 00:03:48,000
183
+ if needed.
184
+
185
+ 47
186
+ 00:03:50,000 --> 00:03:53,000
187
+ Now, let's import data into our database.
188
+
189
+ 48
190
+ 00:03:53,000 --> 00:04:01,000
191
+ Select Data Import Specify is a project folder with your sequel queries or select radio bottom to specify
192
+
193
+ 49
194
+ 00:04:01,000 --> 00:04:02,000
195
+ self-contained file.
196
+
197
+ 50
198
+ 00:04:03,000 --> 00:04:08,000
199
+ You can select schema from where to import data or create a new one.
200
+
201
+ 51
202
+ 00:04:08,000 --> 00:04:15,000
203
+ This is needed for cases if your sequel instructions that you are going to import don't contain, create
204
+
205
+ 52
206
+ 00:04:15,000 --> 00:04:16,000
207
+ schema statement.
208
+
209
+ 53
210
+ 00:04:17,000 --> 00:04:20,000
211
+ After that, just click Start Import button, and that's it.
212
+
213
+ 54
214
+ 00:04:21,000 --> 00:04:24,000
215
+ They understand how to export and import data.
216
+
217
+ 55
218
+ 00:04:24,000 --> 00:04:31,000
219
+ Now, let's now learn how to create users and grant them privileges in management section.
220
+
221
+ 56
222
+ 00:04:31,000 --> 00:04:33,000
223
+ I click on user and privileges.
224
+
225
+ 57
226
+ 00:04:33,000 --> 00:04:36,000
227
+ Sure, you can see list of user accounts.
228
+
229
+ 58
230
+ 00:04:36,000 --> 00:04:39,000
231
+ As you can see, there are some accounts already created.
232
+
233
+ 59
234
+ 00:04:40,000 --> 00:04:41,000
235
+ Let's learn What are they?
236
+
237
+ 60
238
+ 00:04:42,000 --> 00:04:50,000
239
+ One part of the Mexico installation process is Data Directory initialization durin data directory initialization.
240
+
241
+ 61
242
+ 00:04:50,000 --> 00:04:58,000
243
+ My SQL creates user accounts that should be considered to reserve my SQL info schema localhost used
244
+
245
+ 62
246
+ 00:04:58,000 --> 00:05:02,000
247
+ as a definer for information schema of use use of them.
248
+
249
+ 63
250
+ 00:05:02,000 --> 00:05:09,000
251
+ My SQL Info Schema account avoids problems that occur if a database administrator rename or removes
252
+
253
+ 64
254
+ 00:05:09,000 --> 00:05:10,000
255
+ a root account.
256
+
257
+ 65
258
+ 00:05:11,000 --> 00:05:18,000
259
+ Use of the My SQL Info Schema account avoids problems that occur if a database administrator names or
260
+
261
+ 66
262
+ 00:05:18,000 --> 00:05:20,000
263
+ removes the root account.
264
+
265
+ 67
266
+ 00:05:20,000 --> 00:05:26,000
267
+ This account is logged so that it can be used for client connections.
268
+
269
+ 68
270
+ 00:05:27,000 --> 00:05:33,000
271
+ My school session localhost used internally by plug ins to access the server.
272
+
273
+ 69
274
+ 00:05:33,000 --> 00:05:38,000
275
+ This account is locked so that it can't be used for client connections.
276
+
277
+ 70
278
+ 00:05:38,000 --> 00:05:43,000
279
+ My sequels to Sparklehorse used as a defined the forces schema.
280
+
281
+ 71
282
+ 00:05:43,000 --> 00:05:46,000
283
+ Objects use of them are sequels.
284
+
285
+ 72
286
+ 00:05:46,000 --> 00:05:52,000
287
+ Sequences account avoids problems that occur if a DP renames or removes their account.
288
+
289
+ 73
290
+ 00:05:52,000 --> 00:05:57,000
291
+ This account is locked so that it can't be used for client connections.
292
+
293
+ 74
294
+ 00:05:58,000 --> 00:06:06,000
295
+ Root localhost used for administrative purposes, this account has old privileges and can perform any
296
+
297
+ 75
298
+ 00:06:06,000 --> 00:06:06,000
299
+ operation.
300
+
301
+ 76
302
+ 00:06:07,000 --> 00:06:14,000
303
+ Strictly speaking, this account's name is not reserved in the sense that some installations renamed
304
+
305
+ 77
306
+ 00:06:14,000 --> 00:06:20,000
307
+ the root account or something else to avoid exposing a highly privileged account was a well known name.
308
+
309
+ 78
310
+ 00:06:21,000 --> 00:06:27,000
311
+ But what to do in case we need to create a new user was a separate set of religious Zahra might be different
312
+
313
+ 79
314
+ 00:06:27,000 --> 00:06:28,000
315
+ cases.
316
+
317
+ 80
318
+ 00:06:28,000 --> 00:06:33,000
319
+ For example, unions separate account for development purposes and you need to restrict some rights
320
+
321
+ 81
322
+ 00:06:33,000 --> 00:06:38,000
323
+ for it or you create a database account for your application.
324
+
325
+ 82
326
+ 00:06:38,000 --> 00:06:41,000
327
+ And you deliberately want to keep only read rights.
328
+
329
+ 83
330
+ 00:06:41,000 --> 00:06:42,000
331
+ Does it make sense?
332
+
333
+ 84
334
+ 00:06:43,000 --> 00:06:46,000
335
+ The great new user click Add Account here.
336
+
337
+ 85
338
+ 00:06:46,000 --> 00:06:54,000
339
+ We can change the name of new account, select our syndication type for the standard login password
340
+
341
+ 86
342
+ 00:06:54,000 --> 00:06:58,000
343
+ densification select standard that's come up was the passwords.
344
+
345
+ 87
346
+ 00:06:59,000 --> 00:07:05,000
347
+ You can even configure account limit, for example, amount of queries that can be executed per hour
348
+
349
+ 88
350
+ 00:07:06,000 --> 00:07:09,000
351
+ max number of connections concurrent connections.
352
+
353
+ 89
354
+ 00:07:10,000 --> 00:07:14,000
355
+ You can check this step to explore more administrative roles.
356
+
357
+ 90
358
+ 00:07:14,000 --> 00:07:17,000
359
+ Tap, in my opinion, very important one.
360
+
361
+ 91
362
+ 00:07:17,000 --> 00:07:20,000
363
+ You need to grant privileges to your account.
364
+
365
+ 92
366
+ 00:07:20,000 --> 00:07:27,000
367
+ In other words, you'll need to specify what new account can and can't do in the database.
368
+
369
+ 93
370
+ 00:07:27,000 --> 00:07:33,000
371
+ You can select one or more predefined rules, or you can select privileges manually.
372
+
373
+ 94
374
+ 00:07:34,000 --> 00:07:41,000
375
+ It is only up to you and on the last stop here in skimmer privileges, you may said you are just related
376
+
377
+ 95
378
+ 00:07:41,000 --> 00:07:42,000
379
+ to schemas.
380
+
381
+ 96
382
+ 00:07:42,000 --> 00:07:49,000
383
+ You can add rules for all schemas schemas that margins are provided foreign and concrete schemas.
384
+
385
+ 97
386
+ 00:07:50,000 --> 00:07:55,000
387
+ By the way, you can grant and revoke religious even after you create that user account.
388
+
389
+ 98
390
+ 00:07:57,000 --> 00:08:03,000
391
+ After you configure it, everything, just click on the apply button and the user will be created.
392
+
393
+ 99
394
+ 00:08:03,000 --> 00:08:07,000
395
+ So we created account with select privileges only.
396
+
397
+ 100
398
+ 00:08:08,000 --> 00:08:11,000
399
+ Let's now establish new connection using our new credentials.
400
+
401
+ 101
402
+ 00:08:12,000 --> 00:08:14,000
403
+ And let's try to drop some table.
404
+
405
+ 102
406
+ 00:08:33,000 --> 00:08:40,000
407
+ And you can see that when I tried to drop a table, the command wasn't executed, command was denied
408
+
409
+ 103
410
+ 00:08:40,000 --> 00:08:41,000
411
+ for my user.
412
+
413
+ 104
414
+ 00:08:42,000 --> 00:08:46,000
415
+ But I still can select any information I need from this schema.
416
+
417
+ 105
418
+ 00:08:46,000 --> 00:08:47,000
419
+ Is that clear?
420
+
421
+ 106
422
+ 00:08:48,000 --> 00:08:52,000
423
+ Can we understand now how privileges work and how to configure them?
424
+
425
+ 107
426
+ 00:08:53,000 --> 00:08:59,000
427
+ The last thing that I'd like quickly to show you is how to track performance of my SQL server in my
428
+
429
+ 108
430
+ 00:08:59,000 --> 00:09:00,000
431
+ school workbench.
432
+
433
+ 109
434
+ 00:09:00,000 --> 00:09:03,000
435
+ There is a separate section here, as it is called performance.
436
+
437
+ 110
438
+ 00:09:04,000 --> 00:09:07,000
439
+ You can open dashboard and track performance in real time.
440
+
441
+ 111
442
+ 00:09:08,000 --> 00:09:14,000
443
+ On the dashboards, you can find network status, my SQL status and energy status.
444
+
445
+ 112
446
+ 00:09:14,000 --> 00:09:21,000
447
+ When you have queries executed, you will see that this charts will be defined and you can see some
448
+
449
+ 113
450
+ 00:09:21,000 --> 00:09:22,000
451
+ measurements here.
452
+
453
+ 114
454
+ 00:09:23,000 --> 00:09:27,000
455
+ There are separate widgets that allow you to track status of the storage engine.
456
+
457
+ 115
458
+ 00:09:28,000 --> 00:09:31,000
459
+ Most of the metrics and widgets are self-described.
460
+
461
+ 116
462
+ 00:09:32,000 --> 00:09:36,000
463
+ And if you follow this course, there is nothing new for you.
464
+
465
+ 117
466
+ 00:09:37,000 --> 00:09:43,000
467
+ You should already know what in the day is, what SQL statements are, what select and search create
468
+
469
+ 118
470
+ 00:09:43,000 --> 00:09:45,000
471
+ update alternate means.
472
+
473
+ 119
474
+ 00:09:46,000 --> 00:09:49,000
475
+ That's all what I wanted to share with you in this lesson.
476
+
477
+ 120
478
+ 00:09:50,000 --> 00:09:52,000
479
+ Let's recap what we have learned today.
480
+
481
+ 121
482
+ 00:09:53,000 --> 00:09:59,000
483
+ In this lesson, we learned how to make data expert also use, for example, with data inputs.
484
+
485
+ 122
486
+ 00:10:00,000 --> 00:10:01,000
487
+ We created new user with you.
488
+
489
+ 123
490
+ 00:10:02,000 --> 00:10:08,000
491
+ We can figure global privileges POIs and also contributes schema privileges and advantages.
492
+
493
+ 124
494
+ 00:10:08,000 --> 00:10:11,000
495
+ Larson I showed you performance dashboard in my sequel.
496
+
497
+ 125
498
+ 00:10:12,000 --> 00:10:12,000
499
+ That's it.
500
+
501
+ 126
502
+ 00:10:13,000 --> 00:10:15,000
503
+ Thank you all for your attention.
504
+
505
+ 127
506
+ 00:10:15,000 --> 00:10:18,000
507
+ Have a great day and see you in the next lesson.
508
+
49 - Relational Databases (Advanced)/external-links.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+
2
+ 001 Find-folders-with-Views-Triggers-Stored-Procedures-and-Stored-Functions-SQL-query-examples-here
3
+ https://github.com/AndriiPiatakha/learnit_java_core/tree/master/sql_queries/ddl
50 - Databases Database Modelling and Architecture/001 Database Modelling & Design Conceptual, Logical and Physical Data Models_en.srt ADDED
@@ -0,0 +1,1160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:05,000 --> 00:00:11,000
3
+ Hello, Kim, in this lesson, we're going to review very important theoretical concepts of data modeling.
4
+
5
+ 2
6
+ 00:00:12,000 --> 00:00:17,000
7
+ This lesson will be useful for everyone, no matter whether you architect or database engineer.
8
+
9
+ 3
10
+ 00:00:18,000 --> 00:00:24,000
11
+ We need to learn and understand the basic concepts of data modeling on different levels and different
12
+
13
+ 4
14
+ 00:00:24,000 --> 00:00:25,000
15
+ phases of our project.
16
+
17
+ 5
18
+ 00:00:26,000 --> 00:00:33,000
19
+ The fundamental understanding of this process has helped me to save a lot of time and avoid a lot of
20
+
21
+ 6
22
+ 00:00:33,000 --> 00:00:35,000
23
+ mistakes and rework in the past.
24
+
25
+ 7
26
+ 00:00:36,000 --> 00:00:39,000
27
+ That's why I believe it is super important me sharing this with you.
28
+
29
+ 8
30
+ 00:00:40,000 --> 00:00:46,000
31
+ We are going to learn such terms as data model, data context, database design, probably explaining
32
+
33
+ 9
34
+ 00:00:46,000 --> 00:00:49,000
35
+ why data modeling is super important.
36
+
37
+ 10
38
+ 00:00:49,000 --> 00:00:55,000
39
+ And I will provide you with tools and algorithms to ensure efficient process on your project.
40
+
41
+ 11
42
+ 00:00:55,000 --> 00:01:02,000
43
+ And after that, we are going to dive into specifics of different data model types and use those with
44
+
45
+ 12
46
+ 00:01:02,000 --> 00:01:02,000
47
+ examples.
48
+
49
+ 13
50
+ 00:01:03,000 --> 00:01:09,000
51
+ Namely, we are going to discuss conceptual data model, logical data model and physical data model.
52
+
53
+ 14
54
+ 00:01:10,000 --> 00:01:15,000
55
+ But then the last thing you are going to have a clear understanding about each type of data model and
56
+
57
+ 15
58
+ 00:01:15,000 --> 00:01:16,000
59
+ differences between them.
60
+
61
+ 16
62
+ 00:01:17,000 --> 00:01:20,000
63
+ Let's understand first what data model is.
64
+
65
+ 17
66
+ 00:01:20,000 --> 00:01:28,000
67
+ A data model is an abstract model that organizes elements of data and standardize how they relate to
68
+
69
+ 18
70
+ 00:01:28,000 --> 00:01:32,000
71
+ one another and to the properties of the real world with this.
72
+
73
+ 19
74
+ 00:01:33,000 --> 00:01:40,000
75
+ For example, a data model may specify that the data elements representing a car be composed of a number
76
+
77
+ 20
78
+ 00:01:40,000 --> 00:01:49,000
79
+ of elements, which in turn represent a color and the size of the car and define its own term data model
80
+
81
+ 21
82
+ 00:01:49,000 --> 00:01:54,000
83
+ can refer to two distinct but closely related concepts.
84
+
85
+ 22
86
+ 00:01:54,000 --> 00:02:01,000
87
+ Sometimes it refers to an absolute formalization of the objects and relationships found, in particular
88
+
89
+ 23
90
+ 00:02:01,000 --> 00:02:03,000
91
+ application domain.
92
+
93
+ 24
94
+ 00:02:03,000 --> 00:02:11,000
95
+ For example, the customers products and orders found in manufacturing and analyzation, and other times
96
+
97
+ 25
98
+ 00:02:11,000 --> 00:02:16,000
99
+ it refers to a set of concepts used in defining such formalization.
100
+
101
+ 26
102
+ 00:02:17,000 --> 00:02:22,000
103
+ For example, concepts such as entities, attributes, relations or tables.
104
+
105
+ 27
106
+ 00:02:23,000 --> 00:02:29,000
107
+ So is a data model of a banking application may be defined using the entity.
108
+
109
+ 28
110
+ 00:02:29,000 --> 00:02:35,000
111
+ Relationship data model and data model explicitly determines the structure of data.
112
+
113
+ 29
114
+ 00:02:36,000 --> 00:02:40,000
115
+ The next item is related to the previous one database model.
116
+
117
+ 30
118
+ 00:02:41,000 --> 00:02:49,000
119
+ What is a database model that the base model is a type of data model that determines zoological structure
120
+
121
+ 31
122
+ 00:02:49,000 --> 00:02:50,000
123
+ of a database.
124
+
125
+ 32
126
+ 00:02:50,000 --> 00:02:57,000
127
+ It fundamentally determines in which manner data can be stored, organized and manipulated.
128
+
129
+ 33
130
+ 00:02:57,000 --> 00:03:04,000
131
+ The most popular example of database model is a relational model, which uses a table based format.
132
+
133
+ 34
134
+ 00:03:05,000 --> 00:03:12,000
135
+ Database model refers to the logical structure, representation all the out of the database and how
136
+
137
+ 35
138
+ 00:03:12,000 --> 00:03:17,000
139
+ the data will be stored, managed and processed within it.
140
+
141
+ 36
142
+ 00:03:17,000 --> 00:03:26,000
143
+ It helps in designing a database and serves as a blueprint for application developers and database administrators
144
+
145
+ 37
146
+ 00:03:26,000 --> 00:03:27,000
147
+ in creating a database.
148
+
149
+ 38
150
+ 00:03:28,000 --> 00:03:36,000
151
+ You are more or less already familiar with relational data model, so relational data model is an approach
152
+
153
+ 39
154
+ 00:03:36,000 --> 00:03:43,000
155
+ to managing data using a structure and language consistent with logic where all data is represented
156
+
157
+ 40
158
+ 00:03:43,000 --> 00:03:51,000
159
+ in terms of tables grouped into relations, and we learn all the different types of relations in a separate
160
+
161
+ 41
162
+ 00:03:51,000 --> 00:03:51,000
163
+ lesson.
164
+
165
+ 42
166
+ 00:03:52,000 --> 00:03:55,000
167
+ There are three main groups of data models.
168
+
169
+ 43
170
+ 00:03:55,000 --> 00:03:59,000
171
+ They are logical, conceptual and physical.
172
+
173
+ 44
174
+ 00:04:00,000 --> 00:04:04,000
175
+ In this lesson, we are going to go all of them and understand the difference between them.
176
+
177
+ 45
178
+ 00:04:05,000 --> 00:04:11,000
179
+ But before we even try to understand the difference between different groups of data model, let's make
180
+
181
+ 46
182
+ 00:04:11,000 --> 00:04:18,000
183
+ sure that we all understand the importance of data modeling and try to understand motivations that stands
184
+
185
+ 47
186
+ 00:04:18,000 --> 00:04:19,000
187
+ behind this lesson.
188
+
189
+ 48
190
+ 00:04:20,000 --> 00:04:29,000
191
+ Data modeling is a process of creating a visual representation of a whole information system or parts
192
+
193
+ 49
194
+ 00:04:29,000 --> 00:04:33,000
195
+ of it to communicate connections between data points and structures.
196
+
197
+ 50
198
+ 00:04:34,000 --> 00:04:39,000
199
+ The goal is to illustrate the types of data used and stored within the system.
200
+
201
+ 51
202
+ 00:04:39,000 --> 00:04:42,000
203
+ The relationships and ones these data types.
204
+
205
+ 52
206
+ 00:04:42,000 --> 00:04:48,000
207
+ The ways that data can be grouped and organized, and its formats and attributes.
208
+
209
+ 53
210
+ 00:04:49,000 --> 00:04:50,000
211
+ Why we need data modeling.
212
+
213
+ 54
214
+ 00:04:51,000 --> 00:04:52,000
215
+ Can we live without it at all?
216
+
217
+ 55
218
+ 00:04:53,000 --> 00:04:55,000
219
+ Well, to answer objectively.
220
+
221
+ 56
222
+ 00:04:56,000 --> 00:05:02,000
223
+ But in my opinion, we can't leave without data model unions, the development of our app.
224
+
225
+ 57
226
+ 00:05:03,000 --> 00:05:08,000
227
+ It is only a matter of how you will come up with a data model for your app, but you will spend some
228
+
229
+ 58
230
+ 00:05:08,000 --> 00:05:13,000
231
+ time on data monitoring for sure, and it will be done in one or another way.
232
+
233
+ 59
234
+ 00:05:14,000 --> 00:05:20,000
235
+ And what I like to explain this lesson is to give you standardized tools and approaches for data modeling,
236
+
237
+ 60
238
+ 00:05:21,000 --> 00:05:25,000
239
+ because creating proper data models for all app, it is super important task.
240
+
241
+ 61
242
+ 00:05:26,000 --> 00:05:32,000
243
+ And sometimes it is hard just to create a few tables straight away and start using specific data structures
244
+
245
+ 62
246
+ 00:05:32,000 --> 00:05:34,000
247
+ and build your codes around.
248
+
249
+ 63
250
+ 00:05:34,000 --> 00:05:36,000
251
+ Identify dependencies.
252
+
253
+ 64
254
+ 00:05:36,000 --> 00:05:41,000
255
+ If you still can't understand how it is important, think about it.
256
+
257
+ 65
258
+ 00:05:41,000 --> 00:05:48,000
259
+ Also from different than user development of application is performed by multiple developers.
260
+
261
+ 66
262
+ 00:05:48,000 --> 00:05:55,000
263
+ It can be to engineers in case this is early stages of a startup and it can be significantly more engineers
264
+
265
+ 67
266
+ 00:05:55,000 --> 00:05:59,000
267
+ if you already have proof of concept and the boat to start feature development.
268
+
269
+ 68
270
+ 00:06:00,000 --> 00:06:08,000
271
+ Now, imagine that lack of database design and pure data modeling because the or one or even multiple
272
+
273
+ 69
274
+ 00:06:08,000 --> 00:06:09,000
275
+ features.
276
+
277
+ 70
278
+ 00:06:09,000 --> 00:06:12,000
279
+ How much money will you spend on salary of engineers?
280
+
281
+ 71
282
+ 00:06:12,000 --> 00:06:16,000
283
+ The change also caught is it was built around this data model.
284
+
285
+ 72
286
+ 00:06:16,000 --> 00:06:23,000
287
+ Definitely desert techniques of green architecture and introduction of abstraction layer in your app
288
+
289
+ 73
290
+ 00:06:23,000 --> 00:06:26,000
291
+ that minimize rewriting of all persistence layer.
292
+
293
+ 74
294
+ 00:06:27,000 --> 00:06:35,000
295
+ So definitely, this won't be like dramatic impact, but still sometimes changes in business model mapping
296
+
297
+ 75
298
+ 00:06:35,000 --> 00:06:44,000
299
+ may impact business logic and the way how you interact with data inside your app and how you practice
300
+
301
+ 76
302
+ 00:06:44,000 --> 00:06:44,000
303
+ it.
304
+
305
+ 77
306
+ 00:06:44,000 --> 00:06:50,000
307
+ The ability to correct it and devise a business and adjust ends the way we want it to models.
308
+
309
+ 78
310
+ 00:06:50,000 --> 00:06:54,000
311
+ Those relationships is pivotal to good information quality.
312
+
313
+ 79
314
+ 00:06:55,000 --> 00:07:02,000
315
+ Most teams and other musicians opt for physical modeling and great application specific schemas that
316
+
317
+ 80
318
+ 00:07:02,000 --> 00:07:04,000
319
+ often lack the high level vision.
320
+
321
+ 81
322
+ 00:07:04,000 --> 00:07:08,000
323
+ So how is the business really needs to utilize its data?
324
+
325
+ 82
326
+ 00:07:09,000 --> 00:07:12,000
327
+ Also, there is one more related term.
328
+
329
+ 83
330
+ 00:07:12,000 --> 00:07:13,000
331
+ It is database design.
332
+
333
+ 84
334
+ 00:07:14,000 --> 00:07:14,000
335
+ What is it?
336
+
337
+ 85
338
+ 00:07:15,000 --> 00:07:17,000
339
+ Database design is organizational data.
340
+
341
+ 86
342
+ 00:07:17,000 --> 00:07:25,000
343
+ According to database model, the designer determines what data must be stored and how the data elements
344
+
345
+ 87
346
+ 00:07:25,000 --> 00:07:26,000
347
+ interrelate.
348
+
349
+ 88
350
+ 00:07:26,000 --> 00:07:29,000
351
+ Database management system manages the data accordingly.
352
+
353
+ 89
354
+ 00:07:30,000 --> 00:07:36,000
355
+ Database design involves classifying data and identifying interrelationships.
356
+
357
+ 90
358
+ 00:07:36,000 --> 00:07:41,000
359
+ This surgical representation of the data is called an ontology.
360
+
361
+ 91
362
+ 00:07:41,000 --> 00:07:49,000
363
+ The ontology is a theory behind the databases design in order to perform data more an inefficient way.
364
+
365
+ 92
366
+ 00:07:49,000 --> 00:07:52,000
367
+ We need to have a clear understanding of data context.
368
+
369
+ 93
370
+ 00:07:53,000 --> 00:07:59,000
371
+ You can treat data as a puzzle where a puzzle piece is a data entity.
372
+
373
+ 94
374
+ 00:07:59,000 --> 00:08:07,000
375
+ If you would like me to be not so specific in concrete terms but define an abstraction instead of data
376
+
377
+ 95
378
+ 00:08:07,000 --> 00:08:09,000
379
+ entity, we can use any other terms.
380
+
381
+ 96
382
+ 00:08:10,000 --> 00:08:18,000
383
+ So as a piece of Basel, you can use any concept or important thing for business about which we want
384
+
385
+ 97
386
+ 00:08:18,000 --> 00:08:27,000
387
+ to collect data and in order to get it pieces and in order to get the pieces to fit together, you need
388
+
389
+ 98
390
+ 00:08:27,000 --> 00:08:33,000
391
+ to understand the proper relationship of the piece in question to the other puzzle pieces.
392
+
393
+ 99
394
+ 00:08:34,000 --> 00:08:41,000
395
+ The conceptual data model is a picture on the puzzle books that provides a vision of what Information
396
+
397
+ 100
398
+ 00:08:41,000 --> 00:08:47,000
399
+ Basel should look like at the end of the day, regardless of whether your solution is a data warehouse,
400
+
401
+ 101
402
+ 00:08:47,000 --> 00:08:51,000
403
+ ERP mustard that the management or anything else.
404
+
405
+ 102
406
+ 00:08:52,000 --> 00:09:00,000
407
+ Now, let's hear what the conceptual data model is, that conceptual data model is a diagram identifies
408
+
409
+ 103
410
+ 00:09:00,000 --> 00:09:07,000
411
+ the business concepts well, like we usually call them, and that is also this type of data model identifies
412
+
413
+ 104
414
+ 00:09:07,000 --> 00:09:14,000
415
+ the relationships between these concepts in order to gain, reflect and document understanding of the
416
+
417
+ 105
418
+ 00:09:14,000 --> 00:09:16,000
419
+ organization's business from a data perspective.
420
+
421
+ 106
422
+ 00:09:17,000 --> 00:09:20,000
423
+ It shows how the business world sees information.
424
+
425
+ 107
426
+ 00:09:21,000 --> 00:09:27,000
427
+ It suppresses non-critical details in order to emphasize business rules and user objects.
428
+
429
+ 108
430
+ 00:09:28,000 --> 00:09:35,000
431
+ It typically includes on the significant entities which have business meaning, along with their relationships
432
+
433
+ 109
434
+ 00:09:35,000 --> 00:09:39,000
435
+ and conceptual data model usually takes the form of an entity.
436
+
437
+ 110
438
+ 00:09:39,000 --> 00:09:47,000
439
+ Relationship diagram or object role model is a conceptual data model typically does not contain attributes
440
+
441
+ 111
442
+ 00:09:48,000 --> 00:09:55,000
443
+ or if it does on the significant attributes it is important to mention is that the conceptual data model
444
+
445
+ 112
446
+ 00:09:55,000 --> 00:09:59,000
447
+ is technology and application independent.
448
+
449
+ 113
450
+ 00:09:59,000 --> 00:10:06,000
451
+ The conceptual data model should reflect relationships from a historical longitudinal perspective.
452
+
453
+ 114
454
+ 00:10:07,000 --> 00:10:13,000
455
+ For example, a relationship between a store and employee may usually be considered as one too many,
456
+
457
+ 115
458
+ 00:10:14,000 --> 00:10:20,000
459
+ but when viewed from a historical perspective, perhaps zero relationships may actually be managed.
460
+
461
+ 116
462
+ 00:10:20,000 --> 00:10:28,000
463
+ Many whether the employee begins work at another store, why conceptual data model is important and
464
+
465
+ 117
466
+ 00:10:28,000 --> 00:10:34,000
467
+ what issues you may encounter in case you skip trace of conceptual datum or design.
468
+
469
+ 118
470
+ 00:10:35,000 --> 00:10:42,000
471
+ You may be constantly stumbling through zealots conceptual data model, but you won't see the big picture.
472
+
473
+ 119
474
+ 00:10:43,000 --> 00:10:49,000
475
+ It is hard to identify and understand all possible relationships that are required and miss important
476
+
477
+ 120
478
+ 00:10:49,000 --> 00:10:56,000
479
+ seems when you are down in the details of the development and new system from scratch, especially when
480
+
481
+ 121
482
+ 00:10:56,000 --> 00:10:59,000
483
+ you work on some complex enterprise solution.
484
+
485
+ 122
486
+ 00:10:59,000 --> 00:11:08,000
487
+ The three basic tenets of conceptual data model are entity, a real world, single attribute characteristics
488
+
489
+ 123
490
+ 00:11:08,000 --> 00:11:15,000
491
+ or properties of an entity, relationship dependency or association between entities.
492
+
493
+ 124
494
+ 00:11:16,000 --> 00:11:20,000
495
+ Conceptual data model, example, customer and product are two entities.
496
+
497
+ 125
498
+ 00:11:21,000 --> 00:11:28,000
499
+ Customer number and name attributes of the customer, entity, product, name and price are attributes
500
+
501
+ 126
502
+ 00:11:28,000 --> 00:11:29,000
503
+ of product entity.
504
+
505
+ 127
506
+ 00:11:29,000 --> 00:11:32,000
507
+ Sale is a relationship between the customer and product.
508
+
509
+ 128
510
+ 00:11:33,000 --> 00:11:40,000
511
+ As you can see, this is not like super detailed vision of data model, and therefore this is not ready
512
+
513
+ 129
514
+ 00:11:40,000 --> 00:11:46,000
515
+ to use database that is built with the specifics of database management system and logical data model
516
+
517
+ 130
518
+ 00:11:46,000 --> 00:11:49,000
519
+ is a data model of a specific problem.
520
+
521
+ 131
522
+ 00:11:49,000 --> 00:11:55,000
523
+ The main expressed independently of a particular database management product or storage technology,
524
+
525
+ 132
526
+ 00:11:56,000 --> 00:12:03,000
527
+ but nevertheless logical data model is visualized and described in terms of known data structures.
528
+
529
+ 133
530
+ 00:12:03,000 --> 00:12:10,000
531
+ For example, logical data model may be described as relational tables and columns, object oriented
532
+
533
+ 134
534
+ 00:12:10,000 --> 00:12:12,000
535
+ colossus or similar tax.
536
+
537
+ 135
538
+ 00:12:13,000 --> 00:12:18,000
539
+ Sometimes in the literature, you may find that it is referred as logical schema.
540
+
541
+ 136
542
+ 00:12:19,000 --> 00:12:26,000
543
+ Logical database design describes the data without any details of how exactly this data will be physically
544
+
545
+ 137
546
+ 00:12:26,000 --> 00:12:27,000
547
+ implemented.
548
+
549
+ 138
550
+ 00:12:27,000 --> 00:12:35,000
551
+ This database and logical data models It is worse to highlight the next once hierarchical database model.
552
+
553
+ 139
554
+ 00:12:36,000 --> 00:12:39,000
555
+ It is the oldest form of database model.
556
+
557
+ 140
558
+ 00:12:39,000 --> 00:12:43,000
559
+ It was developed by IBM for Information Management System.
560
+
561
+ 141
562
+ 00:12:44,000 --> 00:12:47,000
563
+ It is a set of organized data into structure.
564
+
565
+ 142
566
+ 00:12:48,000 --> 00:12:53,000
567
+ DB Record is a three and system of many groups called segments.
568
+
569
+ 143
570
+ 00:12:54,000 --> 00:12:56,000
571
+ It uses one to many relationships.
572
+
573
+ 144
574
+ 00:12:56,000 --> 00:12:59,000
575
+ The data access is also predictable.
576
+
577
+ 145
578
+ 00:13:00,000 --> 00:13:01,000
579
+ Network model.
580
+
581
+ 146
582
+ 00:13:02,000 --> 00:13:08,000
583
+ It is a database model conceived as a flexible way of representing objects and their relationships.
584
+
585
+ 147
586
+ 00:13:08,000 --> 00:13:17,000
587
+ It's distinguishing feature is that the schema used as a graph in which object types and loads and the
588
+
589
+ 148
590
+ 00:13:17,000 --> 00:13:19,000
591
+ relationship types are arcs.
592
+
593
+ 149
594
+ 00:13:20,000 --> 00:13:26,000
595
+ It is not restricted to being a hierarchy, a lattice relational model.
596
+
597
+ 150
598
+ 00:13:27,000 --> 00:13:33,000
599
+ This is probably one of the most popular data models nowadays, where all data is represented in terms
600
+
601
+ 151
602
+ 00:13:33,000 --> 00:13:40,000
603
+ of doubles grouped into relations, and that your relationship model just collapse into the later things
604
+
605
+ 152
606
+ 00:13:40,000 --> 00:13:41,000
607
+ of interest.
608
+
609
+ 153
610
+ 00:13:42,000 --> 00:13:49,000
611
+ The specific domain of knowledge and basic our model is composed of an entity, Typekit, which classifies
612
+
613
+ 154
614
+ 00:13:49,000 --> 00:13:55,000
615
+ as things of interest and specifies relationships that can exist between entities.
616
+
617
+ 155
618
+ 00:13:55,000 --> 00:13:57,000
619
+ You can see that on diagram.
620
+
621
+ 156
622
+ 00:13:57,000 --> 00:14:04,000
623
+ It is super easy to understand relationships between entities because of reasonable way of depicting
624
+
625
+ 157
626
+ 00:14:04,000 --> 00:14:06,000
627
+ all connections and their types.
628
+
629
+ 158
630
+ 00:14:07,000 --> 00:14:08,000
631
+ Object model.
632
+
633
+ 159
634
+ 00:14:08,000 --> 00:14:15,000
635
+ It is a database management system in which information is represented in the form of object as used
636
+
637
+ 160
638
+ 00:14:15,000 --> 00:14:17,000
639
+ in object oriented programming.
640
+
641
+ 161
642
+ 00:14:17,000 --> 00:14:22,000
643
+ Object databases are different from relational database, which are table oriented.
644
+
645
+ 162
646
+ 00:14:23,000 --> 00:14:26,000
647
+ Object or relational database is a hybrid of both approaches.
648
+
649
+ 163
650
+ 00:14:27,000 --> 00:14:35,000
651
+ Documents model, this is data storage system designed for storing, retrieving and managing documents
652
+
653
+ 164
654
+ 00:14:35,000 --> 00:14:39,000
655
+ oriented information, also known as semi-structured data.
656
+
657
+ 165
658
+ 00:14:39,000 --> 00:14:46,000
659
+ And if you remember our lesson about overview of different database management systems Xeni should remember
660
+
661
+ 166
662
+ 00:14:46,000 --> 00:14:53,000
663
+ is a document model is probably one of the main data models that is used in the design of NoSQL database.
664
+
665
+ 167
666
+ 00:14:54,000 --> 00:14:56,000
667
+ Entity attributes value model.
668
+
669
+ 168
670
+ 00:14:56,000 --> 00:15:03,000
671
+ It is a data model to encode in a space efficient manner, and that is where a number of attributes,
672
+
673
+ 169
674
+ 00:15:04,000 --> 00:15:11,000
675
+ properties parameters can be used to describe them is potentially vast, but the numbers it will actually
676
+
677
+ 170
678
+ 00:15:11,000 --> 00:15:14,000
679
+ apply to even entity is relatively modest.
680
+
681
+ 171
682
+ 00:15:15,000 --> 00:15:22,000
683
+ Such entities correspond to the mathematical notion of sparse markets star schema.
684
+
685
+ 172
686
+ 00:15:23,000 --> 00:15:30,000
687
+ It is the simplest style of data more schema and is the approach most widely used to develop data warehouses
688
+
689
+ 173
690
+ 00:15:30,000 --> 00:15:32,000
691
+ and dimensional data models.
692
+
693
+ 174
694
+ 00:15:33,000 --> 00:15:40,000
695
+ Logical data model is as opposed to a conceptual data model, which describes the semantics of an organization
696
+
697
+ 175
698
+ 00:15:40,000 --> 00:15:42,000
699
+ without reference to technology.
700
+
701
+ 176
702
+ 00:15:43,000 --> 00:15:46,000
703
+ Logical models are often that romantic in nature.
704
+
705
+ 177
706
+ 00:15:47,000 --> 00:15:48,000
707
+ When are they used?
708
+
709
+ 178
710
+ 00:15:49,000 --> 00:15:52,000
711
+ Usually, they're most used in business processes.
712
+
713
+ 179
714
+ 00:15:53,000 --> 00:16:00,000
715
+ Once validated and approved, the logical data model becomes the basis of a physical data model and
716
+
717
+ 180
718
+ 00:16:00,000 --> 00:16:02,000
719
+ for the design of a database.
720
+
721
+ 181
722
+ 00:16:02,000 --> 00:16:10,000
723
+ The term logical data model is sometimes used as a synonym of the mean model or as an alternative to
724
+
725
+ 182
726
+ 00:16:10,000 --> 00:16:11,000
727
+ the mean model.
728
+
729
+ 183
730
+ 00:16:12,000 --> 00:16:19,000
731
+ While the two concepts are closely related and have overlapping goals and the main model is more focused
732
+
733
+ 184
734
+ 00:16:19,000 --> 00:16:21,000
735
+ on capturing the concepts, it a problem.
736
+
737
+ 185
738
+ 00:16:21,000 --> 00:16:30,000
739
+ The main residence structure of the data associated with the main zoological data model is used to define
740
+
741
+ 186
742
+ 00:16:30,000 --> 00:16:35,000
743
+ the structure of data elements and to set relationships between them.
744
+
745
+ 187
746
+ 00:16:36,000 --> 00:16:41,000
747
+ Zoological data model adds further information to the conceptual data model elements.
748
+
749
+ 188
750
+ 00:16:41,000 --> 00:16:48,000
751
+ The advantage of using a logical data model is to provide the foundation, the forms, the base for
752
+
753
+ 189
754
+ 00:16:48,000 --> 00:16:49,000
755
+ the physical model.
756
+
757
+ 190
758
+ 00:16:50,000 --> 00:16:53,000
759
+ However, the model structure remains generic.
760
+
761
+ 191
762
+ 00:16:54,000 --> 00:17:00,000
763
+ The next things that we are going to learn today is to learn more about the group of physical data models.
764
+
765
+ 192
766
+ 00:17:01,000 --> 00:17:08,000
767
+ Let's start from the definition the physical data model is a representation of a data design as implemented
768
+
769
+ 193
770
+ 00:17:08,000 --> 00:17:12,000
771
+ or intended to be implemented in a database management system.
772
+
773
+ 194
774
+ 00:17:13,000 --> 00:17:20,000
775
+ The feel right is a difference between conceptual and logical data models in the lifecycle of a project.
776
+
777
+ 195
778
+ 00:17:20,000 --> 00:17:24,000
779
+ It typically derives from a logical data model.
780
+
781
+ 196
782
+ 00:17:24,000 --> 00:17:29,000
783
+ So it may be reverse engineered from a given database implementation.
784
+
785
+ 197
786
+ 00:17:29,000 --> 00:17:36,000
787
+ A complete physical data model will include all the database artifacts required, the great relationships
788
+
789
+ 198
790
+ 00:17:36,000 --> 00:17:45,000
791
+ between tables or to achieve performance goals such as indexes considering definitions, Lincoln tables,
792
+
793
+ 199
794
+ 00:17:45,000 --> 00:17:47,000
795
+ partition tables or clusters.
796
+
797
+ 200
798
+ 00:17:48,000 --> 00:17:53,000
799
+ Physical database design represents how the actual database is built in.
800
+
801
+ 201
802
+ 00:17:53,000 --> 00:17:59,000
803
+ The first lesson of my course about databases you learned the most popular database management systems.
804
+
805
+ 202
806
+ 00:18:00,000 --> 00:18:05,000
807
+ Please refer to that lesson if you want to check specific names and database management systems.
808
+
809
+ 203
810
+ 00:18:05,000 --> 00:18:14,000
811
+ There are two main physical data models Inverted Index, and that file inverted index that is also referred
812
+
813
+ 204
814
+ 00:18:14,000 --> 00:18:23,000
815
+ to as a custom file or inverted file, is a database in storing and mapping some content, such as words
816
+
817
+ 205
818
+ 00:18:23,000 --> 00:18:30,000
819
+ or numbers, to its location, in a table or in a document, or in a set of documents.
820
+
821
+ 206
822
+ 00:18:30,000 --> 00:18:35,000
823
+ In this course, you also can find less about indexes and how to book with them.
824
+
825
+ 207
826
+ 00:18:36,000 --> 00:18:41,000
827
+ In that lesson, we discuss specifics of interaction with index from its creation until its removal.
828
+
829
+ 208
830
+ 00:18:42,000 --> 00:18:50,000
831
+ The purpose of an inverted index is to allow fast, full text searches at the cost of increased processing.
832
+
833
+ 209
834
+ 00:18:50,000 --> 00:18:54,000
835
+ When a document would just in Utah, Apple is added to the database.
836
+
837
+ 210
838
+ 00:18:54,000 --> 00:19:01,000
839
+ So basically the performance of reading and searching data will be better and will be executed faster.
840
+
841
+ 211
842
+ 00:19:02,000 --> 00:19:07,000
843
+ But on the other hand, operations of insertion will take more time.
844
+
845
+ 212
846
+ 00:19:07,000 --> 00:19:15,000
847
+ That is because after adding additional rule, autoplay indexes needed to be recalculated to stay sorted
848
+
849
+ 213
850
+ 00:19:15,000 --> 00:19:23,000
851
+ and ensure logarithmic connotation for extraction operations, zingers at file may be a database file
852
+
853
+ 214
854
+ 00:19:23,000 --> 00:19:25,000
855
+ itself rather than its index.
856
+
857
+ 215
858
+ 00:19:26,000 --> 00:19:32,000
859
+ It is the most popular data structure used in document retrieval systems used on the large scale.
860
+
861
+ 216
862
+ 00:19:32,000 --> 00:19:35,000
863
+ For example, in search engines.
864
+
865
+ 217
866
+ 00:19:35,000 --> 00:19:42,000
867
+ On the other hand, a flat file database is a database stored in the file called a flat file.
868
+
869
+ 218
870
+ 00:19:43,000 --> 00:19:50,000
871
+ Records follow a uniform format, and there are no structure for indexing or recognizing relationships
872
+
873
+ 219
874
+ 00:19:50,000 --> 00:19:51,000
875
+ between records.
876
+
877
+ 220
878
+ 00:19:51,000 --> 00:19:57,000
879
+ This file is simple a flat file can be a plain text file or a binary file.
880
+
881
+ 221
882
+ 00:19:58,000 --> 00:20:06,000
883
+ Relationships can be inferred from the data in the database, but the database format itself doesn't
884
+
885
+ 222
886
+ 00:20:06,000 --> 00:20:08,000
887
+ make those relationships explicit.
888
+
889
+ 223
890
+ 00:20:08,000 --> 00:20:16,000
891
+ The term has generally implied a small database, but very large that the basis can also be flat.
892
+
893
+ 224
894
+ 00:20:16,000 --> 00:20:23,000
895
+ If you want an example of a flat file database, you can imagine Linnaeus thought of the sequel data.
896
+
897
+ 225
898
+ 00:20:24,000 --> 00:20:29,000
899
+ A physical dating model describes that the base specific implementation of the data model.
900
+
901
+ 226
902
+ 00:20:29,000 --> 00:20:34,000
903
+ It offers database abstraction and helps generate the schema.
904
+
905
+ 227
906
+ 00:20:34,000 --> 00:20:41,000
907
+ The main difference between logical database design and physical database design is that logical database
908
+
909
+ 228
910
+ 00:20:41,000 --> 00:20:45,000
911
+ design helps to define the data elements and their relationships.
912
+
913
+ 229
914
+ 00:20:46,000 --> 00:20:52,000
915
+ But physical database design helps to design the actual database based on the requirements gathered
916
+
917
+ 230
918
+ 00:20:52,000 --> 00:20:56,000
919
+ doing the logical data design and conceptual data design.
920
+
921
+ 231
922
+ 00:20:57,000 --> 00:21:04,000
923
+ We learned what conceptual data model, logical data model and physical data model is to help you understand
924
+
925
+ 232
926
+ 00:21:04,000 --> 00:21:06,000
927
+ better the difference between all of these.
928
+
929
+ 233
930
+ 00:21:07,000 --> 00:21:09,000
931
+ I want to present use of current slide.
932
+
933
+ 234
934
+ 00:21:10,000 --> 00:21:16,000
935
+ So let's recap in one sentence about each type of data model's conceptual data model.
936
+
937
+ 235
938
+ 00:21:17,000 --> 00:21:20,000
939
+ This data model defines what the system contains.
940
+
941
+ 236
942
+ 00:21:21,000 --> 00:21:26,000
943
+ This model is typically created by business stakeholders and data architects.
944
+
945
+ 237
946
+ 00:21:26,000 --> 00:21:32,000
947
+ The purpose is to organize, scope and define business concepts and rules.
948
+
949
+ 238
950
+ 00:21:32,000 --> 00:21:39,000
951
+ Logical data model defines how the system should be implemented regardless of the database management
952
+
953
+ 239
954
+ 00:21:39,000 --> 00:21:39,000
955
+ system.
956
+
957
+ 240
958
+ 00:21:40,000 --> 00:21:45,000
959
+ This model is typically created by data architects and business analysts.
960
+
961
+ 241
962
+ 00:21:45,000 --> 00:21:50,000
963
+ The purpose is to develop a technical map of rules and data structures.
964
+
965
+ 242
966
+ 00:21:51,000 --> 00:21:58,000
967
+ Physical data model This data model describes how the system will be implemented using a specific database
968
+
969
+ 243
970
+ 00:21:58,000 --> 00:21:59,000
971
+ management system.
972
+
973
+ 244
974
+ 00:22:00,000 --> 00:22:04,000
975
+ This model is typically created by database architects and developers.
976
+
977
+ 245
978
+ 00:22:05,000 --> 00:22:08,000
979
+ The purpose is actual implementation of the database.
980
+
981
+ 246
982
+ 00:22:09,000 --> 00:22:15,000
983
+ A conceptual data model identifies the highest level relationships between the different, and that
984
+
985
+ 247
986
+ 00:22:15,000 --> 00:22:22,000
987
+ these features of conceptual data model include the important entities and the relationships among them.
988
+
989
+ 248
990
+ 00:22:23,000 --> 00:22:24,000
991
+ No attribute is specified.
992
+
993
+ 249
994
+ 00:22:24,000 --> 00:22:26,000
995
+ No primary key is specified.
996
+
997
+ 250
998
+ 00:22:27,000 --> 00:22:35,000
999
+ A logical data model describes the data in as much detail as possible without regard to how they will
1000
+
1001
+ 251
1002
+ 00:22:35,000 --> 00:22:37,000
1003
+ be physically implemented in the database.
1004
+
1005
+ 252
1006
+ 00:22:37,000 --> 00:22:44,000
1007
+ Features of logical data model include all entities and relationships, and also all attributes for
1008
+
1009
+ 253
1010
+ 00:22:44,000 --> 00:22:50,000
1011
+ each entity are specified is a primary key for each entity is specified.
1012
+
1013
+ 254
1014
+ 00:22:50,000 --> 00:22:55,000
1015
+ Foreign keys incident defines the relationship between different entities.
1016
+
1017
+ 255
1018
+ 00:22:55,000 --> 00:22:59,000
1019
+ A specified normalization occurs at this level.
1020
+
1021
+ 256
1022
+ 00:23:00,000 --> 00:23:06,000
1023
+ The steps for design and the logical data model are as follows Specified primary keys for all entities
1024
+
1025
+ 257
1026
+ 00:23:07,000 --> 00:23:09,000
1027
+ find the relationships between different entities.
1028
+
1029
+ 258
1030
+ 00:23:10,000 --> 00:23:12,000
1031
+ Find all attributes for each entity.
1032
+
1033
+ 259
1034
+ 00:23:13,000 --> 00:23:17,000
1035
+ Resolve many to many relationships normalization.
1036
+
1037
+ 260
1038
+ 00:23:17,000 --> 00:23:20,000
1039
+ You can learn more about normalization from other lessons.
1040
+
1041
+ 261
1042
+ 00:23:20,000 --> 00:23:26,000
1043
+ Of course, this is also a very important topic, and I dedicated a lot of time and attention to it.
1044
+
1045
+ 262
1046
+ 00:23:27,000 --> 00:23:34,000
1047
+ Physical data model represents how the model will be built into database, a physical database model
1048
+
1049
+ 263
1050
+ 00:23:34,000 --> 00:23:41,000
1051
+ shows all table structures, including column name, column data, type, column constraints, primary
1052
+
1053
+ 264
1054
+ 00:23:41,000 --> 00:23:45,000
1055
+ key, foreign key and relationships between tables.
1056
+
1057
+ 265
1058
+ 00:23:46,000 --> 00:23:51,000
1059
+ Features of a physical data model include specification of all tables and columns.
1060
+
1061
+ 266
1062
+ 00:23:52,000 --> 00:23:55,000
1063
+ Foreign keys are used to identify relationships between tables.
1064
+
1065
+ 267
1066
+ 00:23:56,000 --> 00:24:00,000
1067
+ The normalization may occur based on user requirements.
1068
+
1069
+ 268
1070
+ 00:24:00,000 --> 00:24:06,000
1071
+ If you don't know what the normalization is, please refer to the lesson about normalization and normal
1072
+
1073
+ 269
1074
+ 00:24:06,000 --> 00:24:09,000
1075
+ forms in scope of that lesson.
1076
+
1077
+ 270
1078
+ 00:24:09,000 --> 00:24:12,000
1079
+ I also described what normalization is.
1080
+
1081
+ 271
1082
+ 00:24:13,000 --> 00:24:18,000
1083
+ Physical considerations may cause the physical data model to be quite different from the logical data
1084
+
1085
+ 272
1086
+ 00:24:18,000 --> 00:24:19,000
1087
+ model.
1088
+
1089
+ 273
1090
+ 00:24:19,000 --> 00:24:24,000
1091
+ Physical data model will be different for different database management systems.
1092
+
1093
+ 274
1094
+ 00:24:24,000 --> 00:24:32,000
1095
+ For example, data type for a call made the difference between Oracle and DB two, and also there might
1096
+
1097
+ 275
1098
+ 00:24:32,000 --> 00:24:33,000
1099
+ be other differences.
1100
+
1101
+ 276
1102
+ 00:24:33,000 --> 00:24:41,000
1103
+ The steps for physical data modal design are as follows Converged entities into tables convert relationships
1104
+
1105
+ 277
1106
+ 00:24:41,000 --> 00:24:45,000
1107
+ into foreign keys, convert attributes into columns.
1108
+
1109
+ 278
1110
+ 00:24:46,000 --> 00:24:50,000
1111
+ Modifies the physical data model based on physical constraints.
1112
+
1113
+ 279
1114
+ 00:24:50,000 --> 00:24:50,000
1115
+ Mark ones.
1116
+
1117
+ 280
1118
+ 00:24:51,000 --> 00:24:53,000
1119
+ That's all what I wanted to share with you today.
1120
+
1121
+ 281
1122
+ 00:24:54,000 --> 00:24:57,000
1123
+ You learned a lot of important and interesting things today.
1124
+
1125
+ 282
1126
+ 00:24:58,000 --> 00:25:01,000
1127
+ Let's review what we have learned in this lesson.
1128
+
1129
+ 283
1130
+ 00:25:01,000 --> 00:25:06,000
1131
+ We learned what data model and that the base model is what discussed.
1132
+
1133
+ 284
1134
+ 00:25:06,000 --> 00:25:08,000
1135
+ What database design is.
1136
+
1137
+ 285
1138
+ 00:25:08,000 --> 00:25:12,000
1139
+ Also, we discussed and understood the importance of data modeling process.
1140
+
1141
+ 286
1142
+ 00:25:13,000 --> 00:25:15,000
1143
+ After this lesson, you know what?
1144
+
1145
+ 287
1146
+ 00:25:15,000 --> 00:25:20,000
1147
+ Data context is relative used and learned three main groups of data models.
1148
+
1149
+ 288
1150
+ 00:25:21,000 --> 00:25:25,000
1151
+ They are conceptual, logical and physical data models.
1152
+
1153
+ 289
1154
+ 00:25:26,000 --> 00:25:28,000
1155
+ Thanks a lot for your attention.
1156
+
1157
+ 290
1158
+ 00:25:28,000 --> 00:25:31,000
1159
+ Have a great day and see you in the next lesson.
1160
+
51 - ===== SQL Homework Online Shop =====/001 Homework-with-links-to-solution.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://docs.google.com/document/d/10Wz-j_aerkD-Z9A4reYYp9nPS69NF19w71Fq6YU-M50/edit?usp=sharing
51 - ===== SQL Homework Online Shop =====/001 SQL Homework Task and Solution Review_en.srt ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:06,000 --> 00:00:06,000
3
+ Hello, Jim.
4
+
5
+ 2
6
+ 00:00:07,000 --> 00:00:11,000
7
+ In this video, we're going to review with you your home tasks, the task that I'm going to share with
8
+
9
+ 3
10
+ 00:00:11,000 --> 00:00:15,000
11
+ your supposed to help you learn and understand school topic matter.
12
+
13
+ 4
14
+ 00:00:16,000 --> 00:00:22,000
15
+ If you are students of my Java from zero, the first job course, you should already know that you're
16
+
17
+ 5
18
+ 00:00:22,000 --> 00:00:23,000
19
+ in the course.
20
+
21
+ 6
22
+ 00:00:23,000 --> 00:00:26,000
23
+ We work on creation of our own online shop.
24
+
25
+ 7
26
+ 00:00:26,000 --> 00:00:31,000
27
+ We also need to have a database to support main operations in our online shop.
28
+
29
+ 8
30
+ 00:00:32,000 --> 00:00:38,000
31
+ That's why in today's homework, we are going to have ecommerce terminology anyway.
32
+
33
+ 9
34
+ 00:00:38,000 --> 00:00:43,000
35
+ I believe this will be interesting for you because the whole tasks that I would ask you to implement
36
+
37
+ 10
38
+ 00:00:43,000 --> 00:00:46,000
39
+ are closely related to real life examples.
40
+
41
+ 11
42
+ 00:00:47,000 --> 00:00:52,000
43
+ And the first things that you need to do is to make sure that you have all necessary tables to execute
44
+
45
+ 12
46
+ 00:00:52,000 --> 00:00:59,000
47
+ queries from your home, tasks to help you create all necessary tables, foster and populate data.
48
+
49
+ 13
50
+ 00:00:59,000 --> 00:01:04,000
51
+ I prepared a special script for you that you just need to execute in your database.
52
+
53
+ 14
54
+ 00:01:05,000 --> 00:01:10,000
55
+ Just open this link, copy the script and execute it in your database.
56
+
57
+ 15
58
+ 00:01:11,000 --> 00:01:17,000
59
+ Once this script will be executed, you will notice that five tables created in your database take your
60
+
61
+ 16
62
+ 00:01:17,000 --> 00:01:19,000
63
+ time to explore those tables.
64
+
65
+ 17
66
+ 00:01:19,000 --> 00:01:21,000
67
+ This structure and they things out.
68
+
69
+ 18
70
+ 00:01:22,000 --> 00:01:25,000
71
+ Pay attention to the type of the relationships between different entities.
72
+
73
+ 19
74
+ 00:01:26,000 --> 00:01:31,000
75
+ Once you have all necessary tables and data in it, we are ready to proceed with home tasks.
76
+
77
+ 20
78
+ 00:01:32,000 --> 00:01:38,000
79
+ The first task is to select distinct emails of users who made at least one purchase.
80
+
81
+ 21
82
+ 00:01:39,000 --> 00:01:41,000
83
+ Basically, nuts in this complex here.
84
+
85
+ 22
86
+ 00:01:42,000 --> 00:01:47,000
87
+ This query was required to create joint query to two tables, purchases and user.
88
+
89
+ 23
90
+ 00:01:48,000 --> 00:01:53,000
91
+ The second task would be to create SQL queries that will select product names and purchase ideas for
92
+
93
+ 24
94
+ 00:01:53,000 --> 00:01:54,000
95
+ each purchase.
96
+
97
+ 25
98
+ 00:01:55,000 --> 00:02:00,000
99
+ Set tasks to create sequel statement to select credit card and product name.
100
+
101
+ 26
102
+ 00:02:01,000 --> 00:02:06,000
103
+ You should select credit cards as it was used for purchase of this specific product.
104
+
105
+ 27
106
+ 00:02:07,000 --> 00:02:14,000
107
+ One more task is to select last name of user and total amount of purchases made by this user.
108
+
109
+ 28
110
+ 00:02:14,000 --> 00:02:16,000
111
+ This is going to be a really interesting one.
112
+
113
+ 29
114
+ 00:02:17,000 --> 00:02:22,000
115
+ Select less name of user and total amount of purchases made by this user.
116
+
117
+ 30
118
+ 00:02:22,000 --> 00:02:26,000
119
+ Only for users who make two or more purchases.
120
+
121
+ 31
122
+ 00:02:27,000 --> 00:02:33,000
123
+ And last but not least, task is to select total amount of money user already spent in our store.
124
+
125
+ 32
126
+ 00:02:34,000 --> 00:02:41,000
127
+ As you can see, I tried to come up with real life business cases by implementing this squarish.
128
+
129
+ 33
130
+ 00:02:41,000 --> 00:02:44,000
131
+ You will be able to practice your knowledge in aggregate functions.
132
+
133
+ 34
134
+ 00:02:44,000 --> 00:02:49,000
135
+ Junqueras groupings are results, applying different conditions and so on.
136
+
137
+ 35
138
+ 00:02:50,000 --> 00:02:52,000
139
+ Don't hurry up to check my solution.
140
+
141
+ 36
142
+ 00:02:53,000 --> 00:02:56,000
143
+ Try to take your time and come up with your solution first.
144
+
145
+ 37
146
+ 00:02:57,000 --> 00:03:04,000
147
+ Try to create queries by analogy because during the course, we already created similar queries in some
148
+
149
+ 38
150
+ 00:03:04,000 --> 00:03:04,000
151
+ tasks.
152
+
153
+ 39
154
+ 00:03:04,000 --> 00:03:11,000
155
+ From the least, you may need to have multiple joints, press, pause, and once you are done with your
156
+
157
+ 40
158
+ 00:03:11,000 --> 00:03:13,000
159
+ solution, resumes the video.
160
+
161
+ 41
162
+ 00:03:13,000 --> 00:03:18,000
163
+ And let's compare my and your solution in the first task.
164
+
165
+ 42
166
+ 00:03:18,000 --> 00:03:23,000
167
+ I use distinct keywords to extract only distinct user emails.
168
+
169
+ 43
170
+ 00:03:24,000 --> 00:03:32,000
171
+ I use joint statement to make joint query on purchase table to make sure that I extract only users that
172
+
173
+ 44
174
+ 00:03:32,000 --> 00:03:34,000
175
+ have associated records in purchased table.
176
+
177
+ 45
178
+ 00:03:35,000 --> 00:03:40,000
179
+ I use foreign key in purchased table to map records between two tables.
180
+
181
+ 46
182
+ 00:03:41,000 --> 00:03:43,000
183
+ Here we have one too many relationships.
184
+
185
+ 47
186
+ 00:03:44,000 --> 00:03:50,000
187
+ That's why there is no need in this table, and we can easily implement this relationship with the help
188
+
189
+ 48
190
+ 00:03:50,000 --> 00:03:52,000
191
+ of foreign key and purchase table.
192
+
193
+ 49
194
+ 00:03:52,000 --> 00:03:53,000
195
+ Does it make sense?
196
+
197
+ 50
198
+ 00:03:54,000 --> 00:03:56,000
199
+ Is everything clear so far?
200
+
201
+ 51
202
+ 00:03:57,000 --> 00:04:03,000
203
+ And by the way, team, as always, in case you have any questions, please do not hesitate to put your
204
+
205
+ 52
206
+ 00:04:03,000 --> 00:04:07,000
207
+ questions and comments below this video, and I will be happy to answer those.
208
+
209
+ 53
210
+ 00:04:08,000 --> 00:04:15,000
211
+ Second task is almost similar to the first one in terms that we create joint statements two two tables
212
+
213
+ 54
214
+ 00:04:15,000 --> 00:04:16,000
215
+ only.
216
+
217
+ 55
218
+ 00:04:16,000 --> 00:04:24,000
219
+ We need to extract information about product and we can extracted from product table and to verify in
220
+
221
+ 56
222
+ 00:04:24,000 --> 00:04:26,000
223
+ which purchase this product was purchased.
224
+
225
+ 57
226
+ 00:04:27,000 --> 00:04:30,000
227
+ We need to check this in purchased product table.
228
+
229
+ 58
230
+ 00:04:31,000 --> 00:04:34,000
231
+ In the search task, we need to create multiple joints.
232
+
233
+ 59
234
+ 00:04:34,000 --> 00:04:35,000
235
+ Why?
236
+
237
+ 60
238
+ 00:04:35,000 --> 00:04:42,000
239
+ Because we need to extract credit card value that is stored in user table and product names at the storage
240
+
241
+ 61
242
+ 00:04:42,000 --> 00:04:43,000
243
+ product table.
244
+
245
+ 62
246
+ 00:04:43,000 --> 00:04:49,000
247
+ But to identify which shoes are bought, which products, we need to query purchase table.
248
+
249
+ 63
250
+ 00:04:49,000 --> 00:04:53,000
251
+ Because some purchase table, there is an info about users purchases.
252
+
253
+ 64
254
+ 00:04:54,000 --> 00:05:00,000
255
+ But to understand which product has been purchased in scope of which purchase, we need to query purchase
256
+
257
+ 65
258
+ 00:05:00,000 --> 00:05:06,000
259
+ product table because there is many, too many relationships between product and purchase.
260
+
261
+ 66
262
+ 00:05:07,000 --> 00:05:10,000
263
+ Each purchase may consist of multiple products, correct?
264
+
265
+ 67
266
+ 00:05:11,000 --> 00:05:17,000
267
+ During the one session, I can buy a laptop and separate keyboards, for example, and each product
268
+
269
+ 68
270
+ 00:05:17,000 --> 00:05:19,000
271
+ may be purchased many times.
272
+
273
+ 69
274
+ 00:05:19,000 --> 00:05:24,000
275
+ We have hundreds of the same keyboards, or we have hundreds of similar laptops.
276
+
277
+ 70
278
+ 00:05:25,000 --> 00:05:30,000
279
+ That's why to implement many to many relationships, one needs a smart table.
280
+
281
+ 71
282
+ 00:05:30,000 --> 00:05:37,000
283
+ And in this particular case, we also need to include it in our joint statement to get information that
284
+
285
+ 72
286
+ 00:05:37,000 --> 00:05:37,000
287
+ we need.
288
+
289
+ 73
290
+ 00:05:38,000 --> 00:05:45,000
291
+ We need to specify conditions that will allow us to map records between different tables, including
292
+
293
+ 74
294
+ 00:05:45,000 --> 00:05:46,000
295
+ product table.
296
+
297
+ 75
298
+ 00:05:46,000 --> 00:05:50,000
299
+ And when we execute this query, we receive what we expect.
300
+
301
+ 76
302
+ 00:05:51,000 --> 00:05:57,000
303
+ In the first task, we are going to use aggregate function to count total number of purchases made by
304
+
305
+ 77
306
+ 00:05:57,000 --> 00:06:04,000
307
+ each user after we made select statement to retrieve required information from user and purchase tables.
308
+
309
+ 78
310
+ 00:06:04,000 --> 00:06:09,000
311
+ We need to group results by each user in this particular example.
312
+
313
+ 79
314
+ 00:06:09,000 --> 00:06:12,000
315
+ I want to group results my last name.
316
+
317
+ 80
318
+ 00:06:13,000 --> 00:06:19,000
319
+ You can use analysis if you wish, but probably you already noticed that I use them in all my queries
320
+
321
+ 81
322
+ 00:06:19,000 --> 00:06:23,000
323
+ because I used to do them and I find this comfortable.
324
+
325
+ 82
326
+ 00:06:24,000 --> 00:06:25,000
327
+ One query is executed.
328
+
329
+ 83
330
+ 00:06:26,000 --> 00:06:35,000
331
+ We use user's last name mapped to the total amount of purchases he or she made in our online store in
332
+
333
+ 84
334
+ 00:06:35,000 --> 00:06:36,000
335
+ the fifth task.
336
+
337
+ 85
338
+ 00:06:36,000 --> 00:06:40,000
339
+ We are going to use the same query as in for stock with small additions.
340
+
341
+ 86
342
+ 00:06:40,000 --> 00:06:44,000
343
+ We need to add conditions that will have only records that we need.
344
+
345
+ 87
346
+ 00:06:45,000 --> 00:06:47,000
347
+ That's why I have to go by.
348
+
349
+ 88
350
+ 00:06:47,000 --> 00:06:53,000
351
+ I write have in close to leaf only users that have more or equal to do purchases.
352
+
353
+ 89
354
+ 00:06:54,000 --> 00:06:54,000
355
+ Is it clear?
356
+
357
+ 90
358
+ 00:06:55,000 --> 00:06:59,000
359
+ In the six, Starsk, we also use aggregate function.
360
+
361
+ 91
362
+ 00:06:59,000 --> 00:07:05,000
363
+ This time we need to find total money amount spent in our online shop by each user.
364
+
365
+ 92
366
+ 00:07:06,000 --> 00:07:12,000
367
+ For this, I use some aggregate function to some price of all products that have been purchased by our
368
+
369
+ 93
370
+ 00:07:12,000 --> 00:07:13,000
371
+ user.
372
+
373
+ 94
374
+ 00:07:14,000 --> 00:07:17,000
375
+ And the same logic we have discussed is applied here.
376
+
377
+ 95
378
+ 00:07:18,000 --> 00:07:24,000
379
+ We need to make multiple joints to map all records between each other to extract information we need.
380
+
381
+ 96
382
+ 00:07:24,000 --> 00:07:28,000
383
+ In this example, I group result by user last name.
384
+
385
+ 97
386
+ 00:07:29,000 --> 00:07:36,000
387
+ Basically, that's all my solution, and that's all homework review, hope that this figure was helpful
388
+
389
+ 98
390
+ 00:07:36,000 --> 00:07:41,000
391
+ for you to rack up knowledge nerd in this course and as a reset.
392
+
393
+ 99
394
+ 00:07:42,000 --> 00:07:46,000
395
+ Feel free to ask questions in case of any thanks a lot for your attention.
396
+
397
+ 100
398
+ 00:07:46,000 --> 00:07:49,000
399
+ Have a great day and see you in the next lesson.
400
+
51 - ===== SQL Homework Online Shop =====/external-links.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+
2
+ 001 Homework-with-links-to-solution
3
+ https://docs.google.com/document/d/10Wz-j_aerkD-Z9A4reYYp9nPS69NF19w71Fq6YU-M50/edit?usp=sharing
52 - JDBC/001 JDBC Overview Establish connection with DB from Java App_en.srt ADDED
@@ -0,0 +1,988 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1
2
+ 00:00:06,000 --> 00:00:11,000
3
+ Hello, yes, tenants, I'm happy to announce that the day will start super important topic, we are
4
+
5
+ 2
6
+ 00:00:11,000 --> 00:00:12,000
7
+ going to learn the ABC.
8
+
9
+ 3
10
+ 00:00:13,000 --> 00:00:17,000
11
+ Definitely it will be hard to learn all to this topic and one single lesson.
12
+
13
+ 4
14
+ 00:00:17,000 --> 00:00:23,000
15
+ But the day where I learned to learn basic concepts about the ABC understand what it is.
16
+
17
+ 5
18
+ 00:00:23,000 --> 00:00:29,000
19
+ And the first practical exercise to establish connection is a database from our Java program.
20
+
21
+ 6
22
+ 00:00:30,000 --> 00:00:37,000
23
+ Since this is our first lesson about GBC will start from GBC overview to help you understand what it
24
+
25
+ 7
26
+ 00:00:37,000 --> 00:00:38,000
27
+ is and why we need it.
28
+
29
+ 8
30
+ 00:00:39,000 --> 00:00:46,000
31
+ After that, we are going to review different GDC driver types to make sure you understand more about
32
+
33
+ 9
34
+ 00:00:46,000 --> 00:00:47,000
35
+ database connectivity.
36
+
37
+ 10
38
+ 00:00:47,000 --> 00:00:51,000
39
+ I believe it is important to you and learn what Odyssey is.
40
+
41
+ 11
42
+ 00:00:52,000 --> 00:00:57,000
43
+ I want to make sure that after this lesson, you understand how the book works.
44
+
45
+ 12
46
+ 00:00:57,000 --> 00:01:05,000
47
+ After this piece will jump to practical exercises, we'll learn how to add a driver into the Java app
48
+
49
+ 13
50
+ 00:01:06,000 --> 00:01:11,000
51
+ will establish with your connections as a database to make sure that our environment is ready for the
52
+
53
+ 14
54
+ 00:01:11,000 --> 00:01:11,000
55
+ next lessons.
56
+
57
+ 15
58
+ 00:01:12,000 --> 00:01:14,000
59
+ We have a lot of things to learn today.
60
+
61
+ 16
62
+ 00:01:14,000 --> 00:01:15,000
63
+ Let's start.
64
+
65
+ 17
66
+ 00:01:16,000 --> 00:01:22,000
67
+ Let's start today from understanding of what you did, this is genuine persistence for Java that the
68
+
69
+ 18
70
+ 00:01:22,000 --> 00:01:29,000
71
+ basic connectivity see API implementation used for connecting to a particular type of a database.
72
+
73
+ 19
74
+ 00:01:30,000 --> 00:01:36,000
75
+ It is a standard Java API for database and dependent connectivity between the Java programming language
76
+
77
+ 20
78
+ 00:01:37,000 --> 00:01:40,000
79
+ and the wide range of databases in similar words.
80
+
81
+ 21
82
+ 00:01:41,000 --> 00:01:48,000
83
+ It is a set of glasses and interfaces that allows Java programs to send sequel statements to database.
84
+
85
+ 22
86
+ 00:01:48,000 --> 00:01:49,000
87
+ Why is this a standard?
88
+
89
+ 23
90
+ 00:01:50,000 --> 00:01:56,000
91
+ Imagine that you have a lot of different Java programs and also you have a lot of different relational
92
+
93
+ 24
94
+ 00:01:56,000 --> 00:01:57,000
95
+ database management systems.
96
+
97
+ 25
98
+ 00:01:58,000 --> 00:02:04,000
99
+ The question is, should we use unique application programming interface of each relational database
100
+
101
+ 26
102
+ 00:02:04,000 --> 00:02:06,000
103
+ management system to perform operations?
104
+
105
+ 27
106
+ 00:02:06,000 --> 00:02:13,000
107
+ Was it different protocols and other specifics, for example, unique masses for establishing connection,
108
+
109
+ 28
110
+ 00:02:14,000 --> 00:02:20,000
111
+ unique way to execute SQL queries, unique way to read and modify resulting records, and so on.
112
+
113
+ 29
114
+ 00:02:20,000 --> 00:02:21,000
115
+ No way.
116
+
117
+ 30
118
+ 00:02:22,000 --> 00:02:29,000
119
+ That's why Community Camp was API standard for Java applications to interact with databases, namely
120
+
121
+ 31
122
+ 00:02:30,000 --> 00:02:38,000
123
+ set of interfaces, set of masses and once community agreed on the GDC API, each provider of relation
124
+
125
+ 32
126
+ 00:02:38,000 --> 00:02:43,000
127
+ that the waste management system provided its own implementation of GDC Driver.
128
+
129
+ 33
130
+ 00:02:43,000 --> 00:02:54,000
131
+ So GDC API is just a standard set of API interfaces, and GDC Driver is a concrete implementation is
132
+
133
+ 34
134
+ 00:02:54,000 --> 00:03:01,000
135
+ a clear and thus become area of interest of database providers to create implementation of GDC API,
136
+
137
+ 35
138
+ 00:03:02,000 --> 00:03:07,000
139
+ because Java getting a lot of popularity and common unique solution was needed.
140
+
141
+ 36
142
+ 00:03:07,000 --> 00:03:11,000
143
+ You know that Java could interact with database management system provided.
144
+
145
+ 37
146
+ 00:03:12,000 --> 00:03:16,000
147
+ Z, different bus driver types, let's review each of them one by one.
148
+
149
+ 38
150
+ 00:03:17,000 --> 00:03:23,000
151
+ The first time that I'd like to describe contains a mapping to another data access API.
152
+
153
+ 39
154
+ 00:03:23,000 --> 00:03:25,000
155
+ It is a database driver implementations.
156
+
157
+ 40
158
+ 00:03:25,000 --> 00:03:30,000
159
+ It employs the B C driver to connect to the database.
160
+
161
+ 41
162
+ 00:03:31,000 --> 00:03:34,000
163
+ The driver converts B C mass it calls into audio.
164
+
165
+ 42
166
+ 00:03:34,000 --> 00:03:38,000
167
+ B C function calls logical question from your cycle.
168
+
169
+ 43
170
+ 00:03:38,000 --> 00:03:41,000
171
+ B What is or d b c driver?
172
+
173
+ 44
174
+ 00:03:42,000 --> 00:03:43,000
175
+ And this is a good question.
176
+
177
+ 45
178
+ 00:03:43,000 --> 00:03:46,000
179
+ What do you b c stands for open database connectivity.
180
+
181
+ 46
182
+ 00:03:47,000 --> 00:03:52,000
183
+ It is a standard application programming interface for accessing database management systems.
184
+
185
+ 47
186
+ 00:03:52,000 --> 00:04:00,000
187
+ The designers of or D B C aims to make it independent of database systems and operating systems, and
188
+
189
+ 48
190
+ 00:04:00,000 --> 00:04:07,000
191
+ application written using on the B C can be reported to other platforms both on the client and server
192
+
193
+ 49
194
+ 00:04:07,000 --> 00:04:10,000
195
+ side, with few changes to the data access code.
196
+
197
+ 50
198
+ 00:04:11,000 --> 00:04:18,000
199
+ What a b c was originally developed by Microsoft and Simba Technologies during the early 1990s.
200
+
201
+ 51
202
+ 00:04:19,000 --> 00:04:27,000
203
+ The driver is platform dependent as it makes use of Oadby C, which in turn depends on native libraries
204
+
205
+ 52
206
+ 00:04:27,000 --> 00:04:30,000
207
+ of the underlying operating systems the GVM is running.
208
+
209
+ 53
210
+ 00:04:30,000 --> 00:04:34,000
211
+ The full advantage of this type of driver is obvious.
212
+
213
+ 54
214
+ 00:04:34,000 --> 00:04:42,000
215
+ Almost any database for which the only B C driver is installed can be accessed and data can be retrieved.
216
+
217
+ 55
218
+ 00:04:43,000 --> 00:04:48,000
219
+ Regarding the disadvantages of this type of drama, it is worse than the names of fallen ones that ought
220
+
221
+ 56
222
+ 00:04:48,000 --> 00:04:49,000
223
+ to be seen.
224
+
225
+ 57
226
+ 00:04:49,000 --> 00:04:54,000
227
+ Driver needs to be installed on the client machine performance of her hat sends.
228
+
229
+ 58
230
+ 00:04:54,000 --> 00:05:01,000
231
+ The calls have to go so the GBC bridge to the only busy driver centres, a native database connectivity
232
+
233
+ 59
234
+ 00:05:01,000 --> 00:05:05,000
235
+ interface thus may be slower than other types of drivers.
236
+
237
+ 60
238
+ 00:05:06,000 --> 00:05:10,000
239
+ Specifically, busy drivers are not always available on all platforms.
240
+
241
+ 61
242
+ 00:05:11,000 --> 00:05:14,000
243
+ Hence, visibility of this driver is limited.
244
+
245
+ 62
246
+ 00:05:15,000 --> 00:05:17,000
247
+ No support from Jarvis and A.
248
+
249
+ 63
250
+ 00:05:18,000 --> 00:05:24,000
251
+ The second type of driver is an implementation that uses client side libraries of the target database.
252
+
253
+ 64
254
+ 00:05:25,000 --> 00:05:28,000
255
+ It is also called a native API driver.
256
+
257
+ 65
258
+ 00:05:28,000 --> 00:05:33,000
259
+ The driver converts semester's calls into native course of the database API.
260
+
261
+ 66
262
+ 00:05:34,000 --> 00:05:38,000
263
+ For example, Oracle or assigned driver, is a Typekit driver.
264
+
265
+ 67
266
+ 00:05:39,000 --> 00:05:44,000
267
+ We've got an advantage as we can see that performance is better than a type number one driver.
268
+
269
+ 68
270
+ 00:05:44,000 --> 00:05:51,000
271
+ That is because there is no implementation of GDP C or D B C reach, but it is also has numerous of
272
+
273
+ 69
274
+ 00:05:51,000 --> 00:05:52,000
275
+ disadvantages.
276
+
277
+ 70
278
+ 00:05:52,000 --> 00:05:58,000
279
+ Some of them are the vendor client library needs to be installed on the client machine.
280
+
281
+ 71
282
+ 00:05:59,000 --> 00:06:06,000
283
+ Not all databases have a client side line, but this driver is a platform dependent type.
284
+
285
+ 72
286
+ 00:06:06,000 --> 00:06:12,000
287
+ Number three uses middleware to convert GBC calls into database specific calls.
288
+
289
+ 73
290
+ 00:06:12,000 --> 00:06:21,000
291
+ Also known as a network protocol driver is the middle tyre application server converts because directly
292
+
293
+ 74
294
+ 00:06:21,000 --> 00:06:24,000
295
+ or indirectly into vendor specific database protocol.
296
+
297
+ 75
298
+ 00:06:25,000 --> 00:06:33,000
299
+ This differs from the type for driver in that the protocol conversion logic resides not a decline.
300
+
301
+ 76
302
+ 00:06:33,000 --> 00:06:41,000
303
+ Buttons and middle tyre like type for drivers is a type suite driver is written entirely in Java.
304
+
305
+ 77
306
+ 00:06:42,000 --> 00:06:48,000
307
+ Advantages of this type of driver are the following ones since the communication between the client
308
+
309
+ 78
310
+ 00:06:48,000 --> 00:06:51,000
311
+ and the middle server is database dependent.
312
+
313
+ 79
314
+ 00:06:51,000 --> 00:06:58,000
315
+ There is no need for the database when the library on the client is a client needs not to be changed
316
+
317
+ 80
318
+ 00:06:58,000 --> 00:06:59,000
319
+ for a new database.
320
+
321
+ 81
322
+ 00:07:00,000 --> 00:07:07,000
323
+ Let me go where Sarah can provide typical middleware services like caching of connections, query results,
324
+
325
+ 82
326
+ 00:07:08,000 --> 00:07:16,000
327
+ et cetera, load balancing, logging and auditing a single driver can handle any database provided some
328
+
329
+ 83
330
+ 00:07:16,000 --> 00:07:17,000
331
+ the middle less courses.
332
+
333
+ 84
334
+ 00:07:18,000 --> 00:07:20,000
335
+ I'm on disadvantages of this type of drama.
336
+
337
+ 85
338
+ 00:07:20,000 --> 00:07:26,000
339
+ We shouldn't forget about the next ones, requires database specific coding to be done in the middle
340
+
341
+ 86
342
+ 00:07:26,000 --> 00:07:26,000
343
+ tyre.
344
+
345
+ 87
346
+ 00:07:27,000 --> 00:07:34,000
347
+ Let me know well there and it may result in additional latency, but is typically overcome by using
348
+
349
+ 88
350
+ 00:07:34,000 --> 00:07:35,000
351
+ better middleware services.
352
+
353
+ 89
354
+ 00:07:36,000 --> 00:07:43,000
355
+ That four connects directly to the database by converting GDP scores into database specific calls,
356
+
357
+ 90
358
+ 00:07:44,000 --> 00:07:53,000
359
+ the B c type four driver, also known as a direct database Pure Java driver, is a database driver implementations
360
+
361
+ 91
362
+ 00:07:53,000 --> 00:08:00,000
363
+ that converts basic calls directly into vendor specific database protocol written completely in Java
364
+
365
+ 92
366
+ 00:08:01,000 --> 00:08:08,000
367
+ that for drivers as thus platform independent, they install inside the Java virtual machine of the
368
+
369
+ 93
370
+ 00:08:08,000 --> 00:08:09,000
371
+ client.
372
+
373
+ 94
374
+ 00:08:09,000 --> 00:08:16,000
375
+ This provides better performance isn't the type one and type two drivers, as it doesn't have the overhead
376
+
377
+ 95
378
+ 00:08:16,000 --> 00:08:21,000
379
+ of conversion, of course, into B C O Database API calls.
380
+
381
+ 96
382
+ 00:08:22,000 --> 00:08:26,000
383
+ Unlike the types three drivers, it doesn't need associated software to work.
384
+
385
+ 97
386
+ 00:08:27,000 --> 00:08:32,000
387
+ Advantages are completely implemented in Java to achieve platform independence.
388
+
389
+ 98
390
+ 00:08:33,000 --> 00:08:41,000
391
+ These drivers don't translate the requests into intermediary format, such as Odyssey Zygmunt application
392
+
393
+ 99
394
+ 00:08:41,000 --> 00:08:48,000
395
+ connects directly to the database server, no translation or middleware layers I use, including performance.
396
+
397
+ 100
398
+ 00:08:49,000 --> 00:08:54,000
399
+ The man can manage all aspects of the application to database connection.
400
+
401
+ 101
402
+ 00:08:54,000 --> 00:09:01,000
403
+ This can facilitate debugging, and regarding these advantages, we must add that drivers database specific
404
+
405
+ 102
406
+ 00:09:02,000 --> 00:09:09,000
407
+ has different database vendors to use widely different and usually proprietary network protocols.
408
+
409
+ 103
410
+ 00:09:09,000 --> 00:09:13,000
411
+ But I believe this is not a critical disadvantage, considering all advantages.
412
+
413
+ 104
414
+ 00:09:14,000 --> 00:09:20,000
415
+ Also, nowadays, all major databases have their own implementation of GitLab, and the only things
416
+
417
+ 105
418
+ 00:09:20,000 --> 00:09:26,000
419
+ that you need to do is to add the basic driver into the class of your Java app.
420
+
421
+ 106
422
+ 00:09:27,000 --> 00:09:30,000
423
+ So now, you know, different types of GBC driver.
424
+
425
+ 107
426
+ 00:09:31,000 --> 00:09:36,000
427
+ Probably you already understood that we are going to learn how to work was GBC type four?
428
+
429
+ 108
430
+ 00:09:36,000 --> 00:09:39,000
431
+ Let's recap one more time how it works.
432
+
433
+ 109
434
+ 00:09:39,000 --> 00:09:41,000
435
+ We are going to have program code.
436
+
437
+ 110
438
+ 00:09:42,000 --> 00:09:44,000
439
+ This can be any problem codes.
440
+
441
+ 111
442
+ 00:09:44,000 --> 00:09:52,000
443
+ It performs operations with persistent storage in my course, Java from zero to the first job we create
444
+
445
+ 112
446
+ 00:09:52,000 --> 00:09:54,000
447
+ online shop and the margins.
448
+
449
+ 113
450
+ 00:09:54,000 --> 00:10:01,000
451
+ And during the user registration, we ran some codes that should store user before learning databases,
452
+
453
+ 114
454
+ 00:10:01,000 --> 00:10:03,000
455
+ we store its users and file.
456
+
457
+ 115
458
+ 00:10:03,000 --> 00:10:10,000
459
+ Now that code will interact with GDC API using standard interfaces.
460
+
461
+ 116
462
+ 00:10:10,000 --> 00:10:18,000
463
+ GBC API will use implementation of the API, namely GBC driver for specific database management system
464
+
465
+ 117
466
+ 00:10:19,000 --> 00:10:24,000
467
+ and Z Driver will set com Monsters database management system to execute sequel queries.
468
+
469
+ 118
470
+ 00:10:25,000 --> 00:10:28,000
471
+ Here in the slides, you can see how it works.
472
+
473
+ 119
474
+ 00:10:29,000 --> 00:10:36,000
475
+ Let's now have a lot of them, and I will show you how to add the busy driver to your app and establish
476
+
477
+ 120
478
+ 00:10:36,000 --> 00:10:37,000
479
+ connection with the database.
480
+
481
+ 121
482
+ 00:10:38,000 --> 00:10:44,000
483
+ In this lesson, we are going to do everything from configuration side to be sure that our development
484
+
485
+ 122
486
+ 00:10:44,000 --> 00:10:47,000
487
+ environment is all set for the following lessons.
488
+
489
+ 123
490
+ 00:10:47,000 --> 00:10:54,000
491
+ The first thing that we have to do is to get busy drivers that we need help to understand what driver
492
+
493
+ 124
494
+ 00:10:54,000 --> 00:10:57,000
495
+ we need and where to download it very easily.
496
+
497
+ 125
498
+ 00:10:58,000 --> 00:11:01,000
499
+ Just open your browser and make a Google search.
500
+
501
+ 126
502
+ 00:11:01,000 --> 00:11:04,000
503
+ You have to type Mavin the wrapper for us.
504
+
505
+ 127
506
+ 00:11:04,000 --> 00:11:06,000
507
+ This is a repository is a source.
508
+
509
+ 128
510
+ 00:11:06,000 --> 00:11:10,000
511
+ A lot of artifacts libraries for Java development.
512
+
513
+ 129
514
+ 00:11:10,000 --> 00:11:15,000
515
+ After that puts the name of your database management system and writes GBC.
516
+
517
+ 130
518
+ 00:11:16,000 --> 00:11:21,000
519
+ Google search will show you page that should leave you to name a repository.
520
+
521
+ 131
522
+ 00:11:21,000 --> 00:11:24,000
523
+ In our case, we have my school installed.
524
+
525
+ 132
526
+ 00:11:24,000 --> 00:11:27,000
527
+ That's why I select my school connector.
528
+
529
+ 133
530
+ 00:11:28,000 --> 00:11:34,000
531
+ Depending on the version of database management systems that you installed on your computer, you have
532
+
533
+ 134
534
+ 00:11:34,000 --> 00:11:36,000
535
+ to select driver of the same version.
536
+
537
+ 135
538
+ 00:11:36,000 --> 00:11:40,000
539
+ It will be enough to know at least major version now.
540
+
541
+ 136
542
+ 00:11:40,000 --> 00:11:43,000
543
+ Case you installed my sequel of version eight.
544
+
545
+ 137
546
+ 00:11:44,000 --> 00:11:51,000
547
+ That's why I select Here's the latest version available, and here we can download Java, then load
548
+
549
+ 138
550
+ 00:11:51,000 --> 00:11:52,000
551
+ it on your PC.
552
+
553
+ 139
554
+ 00:11:53,000 --> 00:12:01,000
555
+ Once, to the knowledge, we have to add that into the ClassPass of your project in I.D. In our case,
556
+
557
+ 140
558
+ 00:12:01,000 --> 00:12:02,000
559
+ we are going to use Eclipse.
560
+
561
+ 141
562
+ 00:12:03,000 --> 00:12:09,000
563
+ Let me quickly show you how to that external John to ClassPass in Eclipse Mouse.
564
+
565
+ 142
566
+ 00:12:09,000 --> 00:12:16,000
567
+ Click on your project after that select Built Boss and after that, click on Configure Builds Pass Select
568
+
569
+ 143
570
+ 00:12:16,000 --> 00:12:17,000
571
+ Libraries tab.
572
+
573
+ 144
574
+ 00:12:18,000 --> 00:12:20,000
575
+ Click on ClassPass Boss.
576
+
577
+ 145
578
+ 00:12:20,000 --> 00:12:23,000
579
+ And after that, click on Add External Jar.
580
+
581
+ 146
582
+ 00:12:23,000 --> 00:12:26,000
583
+ After we can click Apply Close.
584
+
585
+ 147
586
+ 00:12:27,000 --> 00:12:27,000
587
+ Great.
588
+
589
+ 148
590
+ 00:12:28,000 --> 00:12:35,000
591
+ Now we have my sequel GBC Driver in our class boss, and we are ready to proceed with writing the code
592
+
593
+ 149
594
+ 00:12:35,000 --> 00:12:37,000
595
+ to establish connection with our database.
596
+
597
+ 150
598
+ 00:12:38,000 --> 00:12:44,000
599
+ All examples related to GDC will be stored in the separate package that is called GDC.
600
+
601
+ 151
602
+ 00:12:45,000 --> 00:12:51,000
603
+ You can find the reference to the court examples that I'm going to show you in this lesson in attachments
604
+
605
+ 152
606
+ 00:12:51,000 --> 00:12:52,000
607
+ to the lesson.
608
+
609
+ 153
610
+ 00:12:53,000 --> 00:12:55,000
611
+ And now we are going through U.
612
+
613
+ 154
614
+ 00:12:55,000 --> 00:12:59,000
615
+ S. Connection example file in this file, we have made massive.
616
+
617
+ 155
618
+ 00:13:00,000 --> 00:13:01,000
619
+ And we can run it.
620
+
621
+ 156
622
+ 00:13:01,000 --> 00:13:05,000
623
+ Let me go line by line to explain what we have here.
624
+
625
+ 157
626
+ 00:13:06,000 --> 00:13:13,000
627
+ If you try to find tutorial in the internet about establishing connection with the database, most likely
628
+
629
+ 158
630
+ 00:13:13,000 --> 00:13:20,000
631
+ you will find a lot of tutorials, whereas the first step is uploading driver loss into class boss in
632
+
633
+ 159
634
+ 00:13:20,000 --> 00:13:23,000
635
+ a modern environment and in our environments setup.
636
+
637
+ 160
638
+ 00:13:24,000 --> 00:13:31,000
639
+ This is not needed since all UBC drivers at the fountains across ClassPass automatically loaded, but
640
+
641
+ 161
642
+ 00:13:31,000 --> 00:13:38,000
643
+ just in case I leave comments lines of code that demonstrates how to upload a class into a G.M..
644
+
645
+ 162
646
+ 00:13:39,000 --> 00:13:40,000
647
+ Why is this is needed?
648
+
649
+ 163
650
+ 00:13:40,000 --> 00:13:49,000
651
+ I mean, the lower driver class when you load driver class like this, or it is loaded into G.M. automatically,
652
+
653
+ 164
654
+ 00:13:49,000 --> 00:13:53,000
655
+ according to general rules, static initialization is executed.
656
+
657
+ 165
658
+ 00:13:54,000 --> 00:14:00,000
659
+ So let's open driver clusters code and investigate what is in the aesthetic consideration.
660
+
661
+ 166
662
+ 00:14:00,000 --> 00:14:05,000
663
+ Love my school connector has open source code available on the top.
664
+
665
+ 167
666
+ 00:14:06,000 --> 00:14:11,000
667
+ And here's how a driver class looks like you can find steady consolidation.
668
+
669
+ 168
670
+ 00:14:11,000 --> 00:14:17,000
671
+ Look here where driver manager is used to register instance of the current driver.
672
+
673
+ 169
674
+ 00:14:18,000 --> 00:14:20,000
675
+ That's why it is enough.
676
+
677
+ 170
678
+ 00:14:20,000 --> 00:14:26,000
679
+ This class just to be loaded into the gym to perform all necessary configurations.
680
+
681
+ 171
682
+ 00:14:27,000 --> 00:14:34,000
683
+ But as I said in our case, Joe will identify a driver in the class bus automatically and will load
684
+
685
+ 172
686
+ 00:14:34,000 --> 00:14:42,000
687
+ driver class driver manager is one out of many classes from Java School Package that will use basically
688
+
689
+ 173
690
+ 00:14:42,000 --> 00:14:45,000
691
+ Angeliki all classes related to school.
692
+
693
+ 174
694
+ 00:14:45,000 --> 00:14:52,000
695
+ A group into Java School Package Driver Manager is a clause that is responsible for managing GBC.
696
+
697
+ 175
698
+ 00:14:52,000 --> 00:14:57,000
699
+ Drivers also will use this class to create objects of connection type.
700
+
701
+ 176
702
+ 00:14:57,000 --> 00:15:00,000
703
+ This will be used to execute SQL statements.
704
+
705
+ 177
706
+ 00:15:00,000 --> 00:15:06,000
707
+ Once we are sure that driver is uploaded into the JVM, we need to establish connection.
708
+
709
+ 178
710
+ 00:15:07,000 --> 00:15:14,000
711
+ Similar to other resources, we need to make sure that all resources are properly closed after they
712
+
713
+ 179
714
+ 00:15:14,000 --> 00:15:15,000
715
+ were used.
716
+
717
+ 180
718
+ 00:15:16,000 --> 00:15:19,000
719
+ That's why we use drivers resources below.
720
+
721
+ 181
722
+ 00:15:19,000 --> 00:15:25,000
723
+ If you're not familiar with this blog, review the details in my complete Java course.
724
+
725
+ 182
726
+ 00:15:25,000 --> 00:15:33,000
727
+ In the input output stream, top insured resources declared in Trailers Resources blog will be automatically
728
+
729
+ 183
730
+ 00:15:33,000 --> 00:15:36,000
731
+ closed after the blog will be completely executed.
732
+
733
+ 184
734
+ 00:15:37,000 --> 00:15:42,000
735
+ Java guarantees this and responsible for proper closure of their sources.
736
+
737
+ 185
738
+ 00:15:43,000 --> 00:15:49,000
739
+ You can put on this blog only Typekit that implements articles about interface.
740
+
741
+ 186
742
+ 00:15:50,000 --> 00:15:56,000
743
+ We use drama manager to get connection object, get connection mass, it is overloaded and we can use
744
+
745
+ 187
746
+ 00:15:56,000 --> 00:15:58,000
747
+ different versions of it.
748
+
749
+ 188
750
+ 00:15:59,000 --> 00:16:00,000
751
+ But there is the same.
752
+
753
+ 189
754
+ 00:16:01,000 --> 00:16:06,000
755
+ You have to pass host of your SQL server where that the base is located and credentials.
756
+
757
+ 190
758
+ 00:16:07,000 --> 00:16:13,000
759
+ You can see that overloaded masses might take is a string, and properties and brokerages says this
760
+
761
+ 191
762
+ 00:16:13,000 --> 00:16:16,000
763
+ case will contain information about user and passwords.
764
+
765
+ 192
766
+ 00:16:17,000 --> 00:16:18,000
767
+ Or you can pass one concatenate.
768
+
769
+ 193
770
+ 00:16:18,000 --> 00:16:23,000
771
+ A string was all acquired information on three separate suites.
772
+
773
+ 194
774
+ 00:16:23,000 --> 00:16:25,000
775
+ In our case, we pass three strings.
776
+
777
+ 195
778
+ 00:16:26,000 --> 00:16:28,000
779
+ Let's look at what actually would pass here.
780
+
781
+ 196
782
+ 00:16:29,000 --> 00:16:33,000
783
+ We concatenate hostname and database name as a first message argument.
784
+
785
+ 197
786
+ 00:16:34,000 --> 00:16:36,000
787
+ After that, we pass user and password.
788
+
789
+ 198
790
+ 00:16:37,000 --> 00:16:43,000
791
+ Definitely storing database credentials in the source code file is not the best practice, but for demo
792
+
793
+ 199
794
+ 00:16:43,000 --> 00:16:46,000
795
+ purposes and for first, the basic program.
796
+
797
+ 200
798
+ 00:16:46,000 --> 00:16:48,000
799
+ I believe for this, OK?
800
+
801
+ 201
802
+ 00:16:48,000 --> 00:16:54,000
803
+ Later, when we will keep implementing our online store, I will show you where to put credentials.
804
+
805
+ 202
806
+ 00:16:55,000 --> 00:17:01,000
807
+ Database name is the one that we created together in the last database.
808
+
809
+ 203
810
+ 00:17:01,000 --> 00:17:08,000
811
+ If you remember, we created a database for our online store project here just to use its name.
812
+
813
+ 204
814
+ 00:17:09,000 --> 00:17:14,000
815
+ Name of the schema, user and passwords is pretty clear and simple.
816
+
817
+ 205
818
+ 00:17:14,000 --> 00:17:22,000
819
+ But let's look at the host name and understand how it looks like it contains that prefix and actually
820
+
821
+ 206
822
+ 00:17:22,000 --> 00:17:23,000
823
+ is a euro.
824
+
825
+ 207
826
+ 00:17:23,000 --> 00:17:26,000
827
+ This a host where our SQL server is running.
828
+
829
+ 208
830
+ 00:17:27,000 --> 00:17:31,000
831
+ In our case, this is localhost and default port.
832
+
833
+ 209
834
+ 00:17:32,000 --> 00:17:35,000
835
+ But how did they define which graphics to use?
836
+
837
+ 210
838
+ 00:17:35,000 --> 00:17:39,000
839
+ Because it's a little bit different for connection with different database management systems.
840
+
841
+ 211
842
+ 00:17:39,000 --> 00:17:44,000
843
+ This year, around establishes a database connection was a Java embedded driver.
844
+
845
+ 212
846
+ 00:17:45,000 --> 00:17:53,000
847
+ The Java DB also includes and that's where Client Driver, which uses a different URL typically in the
848
+
849
+ 213
850
+ 00:17:53,000 --> 00:17:53,000
851
+ database you.
852
+
853
+ 214
854
+ 00:17:54,000 --> 00:18:02,000
855
+ You use the B c word column and database management system name, for example, to create the URL to
856
+
857
+ 215
858
+ 00:18:02,000 --> 00:18:04,000
859
+ establish connection with their database.
860
+
861
+ 216
862
+ 00:18:05,000 --> 00:18:08,000
863
+ You would write GBC Derbyshire for possibly a.
864
+
865
+ 217
866
+ 00:18:09,000 --> 00:18:15,000
867
+ You will use PostgreSQL words here, and we establish in connection to my SQL that the best measurement
868
+
869
+ 218
870
+ 00:18:15,000 --> 00:18:16,000
871
+ system.
872
+
873
+ 219
874
+ 00:18:16,000 --> 00:18:18,000
875
+ That's why I have my sequel here.
876
+
877
+ 220
878
+ 00:18:19,000 --> 00:18:19,000
879
+ Do you understand?
880
+
881
+ 221
882
+ 00:18:20,000 --> 00:18:26,000
883
+ Anyway, you can always check this kind of detail in the documentation or by simply searching the internet.
884
+
885
+ 222
886
+ 00:18:27,000 --> 00:18:29,000
887
+ The main part and that should be followed here.
888
+
889
+ 223
890
+ 00:18:29,000 --> 00:18:33,000
891
+ I describe after we called get a connection method.
892
+
893
+ 224
894
+ 00:18:34,000 --> 00:18:36,000
895
+ The connection variable should be initialized.
896
+
897
+ 225
898
+ 00:18:37,000 --> 00:18:41,000
899
+ If for some reason it is now, that means connection wasn't that thing.
900
+
901
+ 226
902
+ 00:18:42,000 --> 00:18:48,000
903
+ If it is not now, then let's congratulate ourselves with successfully established connection.
904
+
905
+ 227
906
+ 00:18:49,000 --> 00:18:55,000
907
+ Let's run our application and we can see that connection established successfully.
908
+
909
+ 228
910
+ 00:18:56,000 --> 00:18:59,000
911
+ Your connection may throw a sequel exception.
912
+
913
+ 229
914
+ 00:18:59,000 --> 00:19:04,000
915
+ It may be thrown if a database access error occurs was a URL.
916
+
917
+ 230
918
+ 00:19:04,000 --> 00:19:10,000
919
+ Is now also a child exception, maybe strong that is sequel to Mount Exception.
920
+
921
+ 231
922
+ 00:19:11,000 --> 00:19:17,000
923
+ It may be thrown when the driver has determined that the timeout specified by the set logging timeout
924
+
925
+ 232
926
+ 00:19:17,000 --> 00:19:24,000
927
+ method has been ICSI and has at least tried to cancel the current database connection at them.
928
+
929
+ 233
930
+ 00:19:25,000 --> 00:19:28,000
931
+ That's why I handle potential SQL exception here.
932
+
933
+ 234
934
+ 00:19:29,000 --> 00:19:33,000
935
+ That's it, and you can see that connection is successfully established.
936
+
937
+ 235
938
+ 00:19:33,000 --> 00:19:34,000
939
+ Congrats.
940
+
941
+ 236
942
+ 00:19:35,000 --> 00:19:38,000
943
+ That's all what I plans to cover in this lesson.
944
+
945
+ 237
946
+ 00:19:38,000 --> 00:19:40,000
947
+ Let's recap what we have learned today.
948
+
949
+ 238
950
+ 00:19:41,000 --> 00:19:49,000
951
+ In this lesson, we hold GDC overview and learn what is the B C s Valorant different GBC driver types?
952
+
953
+ 239
954
+ 00:19:50,000 --> 00:19:51,000
955
+ I explained you.
956
+
957
+ 240
958
+ 00:19:51,000 --> 00:19:55,000
959
+ What are the B c es after this lesson?
960
+
961
+ 241
962
+ 00:19:55,000 --> 00:19:57,000
963
+ I believe you have understanding how do the do works?
964
+
965
+ 242
966
+ 00:19:58,000 --> 00:20:06,000
967
+ And in real life example, I showed you how to add GBC driver into a Java project and establish connection
968
+
969
+ 243
970
+ 00:20:06,000 --> 00:20:08,000
971
+ from your Java program with a database.
972
+
973
+ 244
974
+ 00:20:08,000 --> 00:20:11,000
975
+ Now we are ready for the next lesson.
976
+
977
+ 245
978
+ 00:20:12,000 --> 00:20:13,000
979
+ That's it for this lesson.
980
+
981
+ 246
982
+ 00:20:14,000 --> 00:20:15,000
983
+ Thanks a lot for your attention.
984
+
985
+ 247
986
+ 00:20:15,000 --> 00:20:18,000
987
+ Have a great day and see you in the next lesson.
988
+
52 - JDBC/001 Source-code-example-from-the-lesson.url ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [InternetShortcut]
2
+ URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jdbc