YouTube2Text

What is Normalization in SQL? | Database Normalization Forms - 1NF, 2NF, 3NF, BCNF | Edureka — Transcript

by edureka! · 2,068 words · 310 segments · language en · Watch on YouTube

Full transcript

  1. 0:00[Music]
  2. 0:11dito in the database is stored in terms
  3. 0:13of enormous quantity retrieving certain
  4. 0:16data will be a tedious task if the data
  5. 0:18is not organized correctly with the help
  6. 0:21of normalization we can organize this
  7. 0:23data and also reduce the redundant data
  8. 0:26hey guys this is predict from Ed Eureka
  9. 0:29and I welcome you all to this
  10. 0:30interesting session on normalization in
  11. 0:32SQL in this session I'll explain
  12. 0:35everything that is related to
  13. 0:36normalization with simple examples that
  14. 0:39are easy to remember firstly let's look
  15. 0:41at the agenda for today's session so
  16. 0:44we're going to start off with
  17. 0:45understanding normalization and moving
  18. 0:47further we shall look at various types
  19. 0:49of normalization and those are first
  20. 0:51normal form second normal form third
  21. 0:54normal form and boyce-codd normal form I
  22. 0:56hope you guys are clear with the agenda
  23. 0:59but before moving further if you haven't
  24. 1:01subscribed to a channel then do
  25. 1:03subscribe to never miss out an update
  26. 1:04with that being said let's get started
  27. 1:07the first topic in today's session is
  28. 1:09what is normalization database
  29. 1:12normalization is a technique of
  30. 1:14organizing the data in the database it
  31. 1:17is a systematic approach of decomposing
  32. 1:19tables to eliminate data redundancy it
  33. 1:21is a multi-step process that puts data
  34. 1:24into tabular form removing the
  35. 1:26duplicated data from its relational
  36. 1:28tables on the screen we just saw that
  37. 1:31the table is getting decomposed into two
  38. 1:33smaller table is it really necessary to
  39. 1:36normalize the table that is present on
  40. 1:38the database well every table in the
  41. 1:40database has to be in the normal form so
  42. 1:43normalization is used mainly for two
  43. 1:45purpose so the first one is it is used
  44. 1:48to eliminate repeated data having
  45. 1:50repeated data in the system not only
  46. 1:52makes the process flow but will cause
  47. 1:54trouble during the later part of
  48. 1:55transactions and second one is to ensure
  49. 1:58the data dependencies make some logical
  50. 2:00sense yes usually the data is stored in
  51. 2:03database with certain logic huge data
  52. 2:06sets without any purpose are completely
  53. 2:08waste it's like having an abundant
  54. 2:11resource without any application
  55. 2:13the data that we have should make some
  56. 2:15logical sense normalization came into
  57. 2:17existence because of the problems that
  58. 2:19occurred on data now let's look at those
  59. 2:22problems and these are known as data
  60. 2:24anomalies if a table is not properly
  61. 2:27normalized and has data redundancy then
  62. 2:30it will not only eat up the extra memory
  63. 2:32space but will also make it difficult to
  64. 2:34handle and update the data base let's
  65. 2:37look at the first anomaly that is
  66. 2:39insertion anomaly suppose for a new
  67. 2:42position in a company mr. Ratchett is
  68. 2:44selected but the department has not been
  69. 2:46allotted for him in that case if we want
  70. 2:49to update his information to the
  71. 2:50database we need to set the department
  72. 2:52information as null similarly if we have
  73. 2:55to insert data of thousand employees who
  74. 2:58are in similar situation then the
  75. 3:00department information will be repeated
  76. 3:02for all those thousand employees this
  77. 3:05scenario is a classical example of
  78. 3:07insertion anomalies the next one is
  79. 3:09update anomaly what if mr. Ratchett
  80. 3:12leaves the company or is in no longer
  81. 3:15the head of the marketing department in
  82. 3:16that case all the employee records will
  83. 3:19have to be updated and if by mistake we
  84. 3:22miss any record it will lead to data
  85. 3:24inconsistency this is nothing but
  86. 3:26updation anomaly and the final one is
  87. 3:30deletion anomaly in our employee table
  88. 3:33two different pieces of information are
  89. 3:35kept together that is employee
  90. 3:37information and Department information
  91. 3:39hence at the end of financial year
  92. 3:42if employee records are deleted we will
  93. 3:44also lose the department information
  94. 3:46this is nothing but deletion anomaly so
  95. 3:49these were some of the problems that
  96. 3:51occurred while managing the data to
  97. 3:53eliminate all these anomalies
  98. 3:55normalization came into existence
  99. 3:57there are many normal forms which are
  100. 3:59still under development but let's focus
  101. 4:01on the very basic and the essential ones
  102. 4:03only so we will be talking about first
  103. 4:06normal form second normal form third
  104. 4:09normal form and finally end this session
  105. 4:11with boyce-codd normal form so without
  106. 4:14wasting for the time let's proceed your
  107. 4:16first normal form
  108. 4:17in first normal form we tackle the
  109. 4:20problem of atomicity here at alma city
  110. 4:23means values in the table should not be
  111. 4:25further divided in simple terms a single
  112. 4:28cell cannot hold multiple values if a
  113. 4:31table contains a composite or
  114. 4:32multivalued attributes it violates the
  115. 4:35first normal form so the following
  116. 4:37functions will be performed in first
  117. 4:39normal form the first one is it removes
  118. 4:41repeating groups from the table and next
  119. 4:44it creates a separate table for each set
  120. 4:46of related data and finally it
  121. 4:49identifies each set of related data with
  122. 4:51the primary key to understand this in a
  123. 4:54better way let's look at the given table
  124. 4:56in the employee table we have employee
  125. 4:59ID employee name phone number and salary
  126. 5:03as columns we can clearly see that the
  127. 5:05phone number column has two values thus
  128. 5:08it violates the first normal form now if
  129. 5:11we apply the first normal form to the
  130. 5:13above table we get the following result
  131. 5:15in this table each and every row is
  132. 5:18listing that is no cell has multiple
  133. 5:21values the table has achieved a dhama
  134. 5:24city first normal form is simple and can
  135. 5:27be easily identified in the table we can
  136. 5:30clearly see there is no multiple values
  137. 5:32in each and every column thus the first
  138. 5:35normal form is achieved now let's move
  139. 5:38to the second normal form second normal
  140. 5:40form was originally defined by EF chord
  141. 5:43in 1971 a table is said to be in second
  142. 5:47normal form only when it fulfills the
  143. 5:49following condition the first condition
  144. 5:52is it has to be in first normal form and
  145. 5:54the second one is the table also should
  146. 5:57not contain partial dependency here
  147. 6:00partial dependency means the proper
  148. 6:02subset of a candidate key determines a
  149. 6:05non-prime attribute so what is a
  150. 6:07non-prime attribute let's understand
  151. 6:10this in a simple way attributes that
  152. 6:12form a candidate key in a table or
  153. 6:14called Prime attributes and the rest of
  154. 6:16the attributes of the relation are non
  155. 6:18prime for a table prime attributes can
  156. 6:21be like employee ID and Department ID
  157. 6:23and the non prime attributes can be like
  158. 6:26office location to understand second
  159. 6:29normal form let's consider this table
  160. 6:31this table has a composite primary key
  161. 6:34that is employee ID and department ID
  162. 6:37makes a primary key the non key
  163. 6:39attribute is office location in this
  164. 6:42case office location only depends on
  165. 6:44department ID which is only the power of
  166. 6:47primary key
  167. 6:48therefore this table does not satisfy
  168. 6:50the second normal form so what to do in
  169. 6:53such scenario the answer is simple
  170. 6:56split the table accordingly to bring
  171. 6:59this table to second normal form we need
  172. 7:01to break the table into two parts which
  173. 7:03will give the following tables the first
  174. 7:05table has employee ID and department ID
  175. 7:08as columns the second one has department
  176. 7:11ID and office location as columns as you
  177. 7:14can see we have removed the partial
  178. 7:16functional dependency that we initially
  179. 7:18had now in the table the column office
  180. 7:21location is fully dependent on the
  181. 7:23primary key of that table which is
  182. 7:25nothing but department ID I hope you
  183. 7:28understood second normal form now that
  184. 7:30we have learned first normal form and
  185. 7:32second normal form let's head to the
  186. 7:34next part of this normalization next
  187. 7:37topic is third normal form third normal
  188. 7:39form is a normal form that is used in
  189. 7:42normalizing the table to reduce the
  190. 7:44duplication of data and ensure
  191. 7:45referential integrity the following
  192. 7:48condition has to be met by the table to
  193. 7:50be in third normal form and the first
  194. 7:52condition is the table has to be in
  195. 7:54second normal form and the second
  196. 7:56condition is no non-prime attribute is
  197. 7:59transitively dependent on any non-prime
  198. 8:02attribute which depends on other non
  199. 8:04prime attributes
  200. 8:05I know it's bit confusing so let me make
  201. 8:08it simple for you it's like if C is
  202. 8:10dependent on B and in turn B is
  203. 8:13dependent on a then transitively C is
  204. 8:16dependent on a this should not happen in
  205. 8:18third normal form all the non prime
  206. 8:21attributes must depend only on the prime
  207. 8:23attributes
  208. 8:25these are the two necessary condition
  209. 8:26that needs to be attained so why was the
  210. 8:29normal form design firstly to eliminate
  211. 8:32undesirable data anomalies next one is
  212. 8:35to reduce the need for restructuring
  213. 8:37over time and finally to make the data
  214. 8:40model more informaiton since we have
  215. 8:43understood the third normal form let's
  216. 8:45look at the example table in the above
  217. 8:47table student ID determines subject ID
  218. 8:50and subject ID determine subject
  219. 8:52therefore student ID determines subject
  220. 8:55yr subject ID this implies that we have
  221. 8:58transitive functional dependency and
  222. 9:00this table does not satisfy the third
  223. 9:03normal form now in order to achieve the
  224. 9:06normal form we need to divide the table
  225. 9:08as shown below
  226. 9:09firstly let's divide the table and store
  227. 9:12student ID student name subject ID and
  228. 9:15address in it all the columns are
  229. 9:17referring to the primary key which is
  230. 9:19student ID let the second table have
  231. 9:22subject ID and subject column so subject
  232. 9:25is dependent only on subject ID and not
  233. 9:28on student ID as you can see from the
  234. 9:31above table all the non-key attributes
  235. 9:33are now fully functionally dependent
  236. 9:35only on the primary key in the first
  237. 9:37table column such as student name
  238. 9:40subject ID and address are only
  239. 9:42dependent on student ID in the second
  240. 9:45table subject is only dependent on
  241. 9:47subject ID with this being understood
  242. 9:50now we can proceed further to next
  243. 9:52normal form that is Boyce Codd normal
  244. 9:53form this is also known as 3.5 normal
  245. 9:57form it is the higher version of third
  246. 10:00normal form and was developed by Raymond
  247. 10:02F boys and Edgar F Codd to address
  248. 10:05certain types of anomalies which were
  249. 10:07not dealt with third normal form before
  250. 10:09proceeding to Boyce Codd normal form the
  251. 10:11table has to satisfy third normal form
  252. 10:13in Boyce Codd normal form if every
  253. 10:17functional dependency that is a implies
  254. 10:19B then a has to be the super key of that
  255. 10:22particular table so what is a super key
  256. 10:25a super key is a group of single or
  257. 10:27multiple keys which identifies rows in a
  258. 10:30table let's look at the table to clearly
  259. 10:33understand Boyce Codd normal form
  260. 10:35in the given table one student can
  261. 10:38enroll for multiple subjects there can
  262. 10:40be multiple professor teaching one
  263. 10:42subject and for each subject a professor
  264. 10:45is assigned to the student these are the
  265. 10:48necessary condition of the stable in
  266. 10:50this table all the normal forms are
  267. 10:52satisfied except boyce-codd normal form
  268. 10:55Y as you can see that student ID and
  269. 10:58subject form the primary key which means
  270. 11:01that the subject column is prime
  271. 11:03attribute but there is one more
  272. 11:05dependency that is professor is
  273. 11:07depending on subject and well subject is
  274. 11:10a prime attribute professor is a
  275. 11:12non-prime attribute which is not allowed
  276. 11:14by boyce-codd normal form now in order
  277. 11:17to satisfy the boyce-codd normal form we
  278. 11:20will be dividing the table into two
  279. 11:21parts the table at the top will hold
  280. 11:24student ID which already exists and we
  281. 11:27will create a new column that is
  282. 11:28professor ID and in the second table
  283. 11:31which is below we'll have the columns
  284. 11:33professor ID professor and subject
  285. 11:36columns why do we need to have a new
  286. 11:38column that is professor ID by doing
  287. 11:41this we are removing the non prime
  288. 11:43attributes functional dependency in the
  289. 11:46second table professor ID will be the
  290. 11:48super key of that table
  291. 11:49and remaining column will be
  292. 11:51functionally dependent on it by doing
  293. 11:53this we are satisfying boyce-codd normal
  294. 11:55form so this brings us to the end of
  295. 11:58this session I hope you have clearly
  296. 12:00understood the normalization and its
  297. 12:02different types if you have any queries
  298. 12:05or doubts regarding this session please
  299. 12:06let me know in the comment section and
  300. 12:08I'll get back to you with an answer
  301. 12:10thank you guys for watching this video
  302. 12:12and have a great day
  303. 12:14I hope you have enjoyed listening to
  304. 12:16this video please be kind enough to like
  305. 12:18it and you can comment any of your
  306. 12:21doubts and queries and we will reply
  307. 12:23them at the earliest do look out for
  308. 12:26more videos in our playlist and
  309. 12:27subscribe to any rekha channel to learn
  310. 12:30more happy learning

About this transcript

This page contains the full transcript of What is Normalization in SQL? | Database Normalization Forms - 1NF, 2NF, 3NF, BCNF | Edureka by edureka!, generated from the public captions YouTube serves with the video. The transcript has 2,068 words across 310 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.