<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anas on Medium]]></title>
        <description><![CDATA[Stories by Anas on Medium]]></description>
        <link>https://medium.com/@anasstudy96?source=rss-b423e0dbc1b5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jO4GBcG3v8beXH3Miozq8Q.jpeg</url>
            <title>Stories by Anas on Medium</title>
            <link>https://medium.com/@anasstudy96?source=rss-b423e0dbc1b5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 12:06:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anasstudy96/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Design Database in 2024 ?]]></title>
            <link>https://medium.com/@anasstudy96/how-to-design-database-in-2024-135296f6605f?source=rss-b423e0dbc1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/135296f6605f</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[postgressql]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[relational-databases]]></category>
            <dc:creator><![CDATA[Anas]]></dc:creator>
            <pubDate>Sun, 01 Sep 2024 20:13:55 GMT</pubDate>
            <atom:updated>2024-09-01T20:13:55.015Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Design Database in 2024 ?</h3><p><strong>Understand your requirements</strong></p><p>The first thing when we start to design is to know our requirements. We should identify what kind of data it is, How much will the data will be? How complex it is also what will be changes and challenges with going forward. Still we cant tackle our requirements 100% but will save us lot of time and effort going forward</p><p><strong>Selecting the right database</strong></p><p>After knowing the data and how the data will be we need to choose right database for our project. In here we will talk about relational and NoSql databases.</p><p>Lets have a quick overview of these database.</p><p><em>Relational Database</em></p><p>Also known as SQL databases, these databases organise data into tables, rows, and columns to show relationships between data points. This structure makes it easy to access, create, read, modify, and delete data using a querying language like SQL. Relational databases are more flexible than hierarchical databases and can handle more complex data structure</p><p>eg:/ MySQL, PostgreSQL, Oracle etc..</p><p><em>NoSQL Database</em></p><p>Also known as non-relational databases, these databases are designed to handle large amounts of unstructured or semi-structured data. They don’t use the traditional table-based relational database model, instead using a variety of data models like key-value pairs, documents, and graphs. NoSQL databases are good for organizations that want to store unstructured or semi-structured data, and developers can make changes to the database without affecting applications that use it.</p><p>eg:/ MongoDB, Cassandra,Couchbase etc…</p><p>So based on requirements we should select our preferred Database.</p><p>So Now we have selected our database. Onto very important topic when it comes designing database. <strong>Normalization.</strong></p><p><strong>Normalization</strong></p><p>Normalization involves organizing your database to reduce redundancy and improve data integrity.</p><p>There are multiple normals that you can follow when it comes to normalizing. <strong>Normal Forms</strong> - 1NF, 2NF, 3NF, BCNF, etc. As order suggests the more normalized it gets higher the quality of database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*54xlMLneq1aIjOMcTV8yTg.png" /><figcaption>Some Normal forms and its rules.</figcaption></figure><p>When it comes to real world the best way to ensure our integrity and scalability of database is to satisfy at least upto <strong>3NF</strong>.</p><p>So I will be listing out rules of first 3 normal forms.</p><p><strong>1NF (First Normal Form)</strong></p><p>Rules<strong>:</strong></p><ol><li><strong>Atomicity:</strong> Each column must contain atomic (indivisible) values. No repeating groups or arrays.</li><li><strong>Uniqueness:</strong> Each column should be unique in its data set.</li><li><strong>Unique Rows:</strong> Each row must be unique; this usually requires a primary key.</li></ol><p><strong>Example:</strong> Consider a table of student records that contains a column for “Course” with multiple values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o__6_z8J80qALvQDl1b7yw.png" /></figure><p>This table is <strong>not in 1NF</strong> because the “Courses” column contains multiple values.</p><p>To transform into <strong>1NF</strong>, we need to split the “Courses” into separate rows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mBvKpVZTdg1Z8YlxBvYTww.png" /></figure><p><strong>2NF (Second Normal Form)</strong></p><p>Rules<strong>:</strong></p><ol><li>Must be in 1NF.</li><li><strong>No Partial Dependency:</strong> All non-key attributes must be fully functionally dependent on the entire primary key (not just part of it).</li></ol><p><strong>Example:</strong> Consider the following table, which is in 1NF but not 2NF:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QcfESue2KDyuqepFmpb4kA.png" /></figure><p>Here, the table is <strong>not in 2NF</strong> because “StudentName” depends only on “StudentID,” and “CourseName” depends only on “CourseID.”</p><p>To transform into <strong>2NF</strong>, we create two separate tables:</p><p><strong>Students Table:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dAHYMKZ2HGdAw8LsXbv1Yg.png" /><figcaption>students table</figcaption></figure><p><strong>Courses Table:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AykQpS0cn8QGdjM5EH7-6A.png" /><figcaption>courses table</figcaption></figure><p><strong>Enrollment Table</strong> (New Table for Many-to-Many Relationship)<strong>:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XtfT6KRnEZyWe0EG-ByX8Q.png" /><figcaption>enrollment table</figcaption></figure><p><strong>3NF (Third Normal Form)</strong></p><p><strong>Rules:</strong></p><ol><li>Must be in 2NF.</li><li><strong>No Transitive Dependency:</strong> Non-key attributes should not depend on other non-key attributes.</li></ol><p><strong>Example:</strong> Consider the following table, which is in 2NF but not 3NF:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5lIPF0wM2q1uAXmjHbWYQ.png" /></figure><p>Here, the table is <strong>not in 3NF</strong> because “Instructor” depends on “CourseName,” not on “StudentID” or “CourseID” directly.</p><p>To transform into <strong>3NF</strong>, we need to separate the attributes based on their dependencies:</p><p><strong>Courses Table:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHYbMFaEXiNlPu5E3dYkjg.png" /><figcaption>courses table</figcaption></figure><p><strong>Students Table:</strong> (remains the same):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RK4xUylfRw_diB8K5Bc0SA.png" /></figure><p><strong>Enrollment Table:</strong> (remains the same):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_E-hfy_5xQUvFK9IIf8-hg.png" /></figure><p>Now, each non-key attribute depends only on the primary key of its respective table, satisfying 3NF.</p><p>Now we covered first three normal forms, so Why did only first three forms ? … In any business we must satisfy at least first 3 forms.</p><p>So I encourage everyone who read this to go through it again and have clear gasp on these standards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=135296f6605f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>