Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I try to attempt to explain normalization in layman terms here. First off, it is something that applies to relational database (Oracle, Access, MySQL) so it is not only for MySQL.</p> <p>Normalisation is about making sure each table has the only minimal fields and to get rid of dependencies. Imagine you have an employee record, and each employee belongs to a department. If you store the department as a field along with the other data of the employee, you have a problem - what happens if a department is removed? You have to update all the department fields, and there's opportunity for error. And what if some employees does not have a department (newly assigned, perhaps?). Now there will be null values.</p> <p>So the normalisation, in brief, is to avoid having fields that would be null, and making sure that the all the fields in the table only belong to one domain of data being described. For example, in the employee table, the fields could be id, name, social security number, but those three fields have nothing to do with the department. Only employee id describes which department the employee belongs to. So this implies that which department an employee is in should be in another table.</p> <p>Here's a simple normalization process.</p> <pre><code>EMPLOYEE ( &lt; employee_id &gt;, name, social_security, department_name) </code></pre> <p>This is not normalized, as explained. A normalized form could look like</p> <pre><code>EMPLOYEE ( &lt; employee_id &gt;, name, social_security) </code></pre> <p>Here, the Employee table is only responsible for one set of data. So where do we store which department the employee belongs to? In another table</p> <pre><code>EMPLOYEE_DEPARTMENT ( &lt; employee_id &gt;, department_name ) </code></pre> <p>This is not optimal. What if the department name changes? (it happens in the US government all the time). Hence it is better to do this</p> <pre><code>EMPLOYEE_DEPARTMENT ( &lt; employee_id &gt;, department_id ) DEPARTMENT ( &lt; department_id &gt;, department_name ) </code></pre> <p>There are first normal form, second normal form and third normal form. But unless you are studying a DB course, I usually just go for the most normalized form I could understand.</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload