<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Arinze</title>
    <description>The latest articles on Forem by Arinze (@pocharis).</description>
    <link>https://forem.com/pocharis</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F145337%2Fd0117155-9666-4a02-ba89-125e32719f86.jpg</url>
      <title>Forem: Arinze</title>
      <link>https://forem.com/pocharis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/pocharis"/>
    <language>en</language>
    <item>
      <title>Python Word Split Algorithm, Coderbyte</title>
      <dc:creator>Arinze</dc:creator>
      <pubDate>Fri, 17 Jun 2022 10:17:43 +0000</pubDate>
      <link>https://forem.com/pocharis/python-word-split-algorithm-coderbyte-2663</link>
      <guid>https://forem.com/pocharis/python-word-split-algorithm-coderbyte-2663</guid>
      <description>&lt;h2&gt;
  
  
  Problem Definition:
&lt;/h2&gt;

&lt;p&gt;Have the function &lt;em&gt;WordSplit(strArr)&lt;/em&gt; read the array of strings stored in &lt;em&gt;strArr&lt;/em&gt;, which will contain 2 elements: the first element will be a sequence of characters, and the second element will be a long string of comma-seperated words, in alphabetical order, that represents a dictionary of some arbitrary length. For example: strArr can be:&lt;br&gt;
["hellocat", "apple, bat, cat, goodbye, hello, yellow, why"].&lt;br&gt;
Your goal is to determine if the first element in the input can be split into two words, where both words in the dictionary that is provided in the second input.&lt;br&gt;
In this example, the firs element can be split into two words:&lt;br&gt;
&lt;strong&gt;hello&lt;/strong&gt; and &lt;strong&gt;cat&lt;/strong&gt; because both of those words are in the dictionary.&lt;/p&gt;

&lt;p&gt;Your program should return the two words that exist in the dictionary separated by a comma. So for the example above, your program should return hello, cat. There will only be one correct way to split the first element of characters into two words. If there is no way to split string into two words that exist in the dictionary, return the string not possible. The first element itself will never exist in the dictionary as a real word.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# define the function to manipulate string
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;WordSplit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strArr&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strArr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
    &lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;subtract a string from the main string&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;

    &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;strArr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  

    &lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;then search through the other strings and compare with the remainder after subtraction&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;strArr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;strArr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;,&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;not possible&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="n"&gt;strArr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;baseball&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;a, all, b, ball,base,  bas,  cat, code, d, e, quit, z&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;#test case
&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;WordSplit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strArr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    
&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;intersperse this code with the ouput of the function&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;
&lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;fg23klq6r9&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;intersperse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;intersperse&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>code</category>
      <category>algorithms</category>
      <category>coderbyte</category>
    </item>
    <item>
      <title>Relational Database Design to store University timetables and record of students’ attendance.</title>
      <dc:creator>Arinze</dc:creator>
      <pubDate>Sun, 20 Dec 2020 22:39:14 +0000</pubDate>
      <link>https://forem.com/pocharis/relational-database-design-to-store-university-timetables-and-record-of-students-attendance-3jg4</link>
      <guid>https://forem.com/pocharis/relational-database-design-to-store-university-timetables-and-record-of-students-attendance-3jg4</guid>
      <description>&lt;h3&gt;
  
  
  WORK OUTLINE:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;PROBLEM AREA&lt;/li&gt;
&lt;li&gt;SCOPE OF WORK&lt;/li&gt;
&lt;li&gt;RELATIONSHIPS&lt;/li&gt;
&lt;li&gt;ENTITY RELATIONSHIP DIAGRAM (ASSUMPTIONS/LIMITATIONS)&lt;/li&gt;
&lt;li&gt;RELATIONAL TABLES&lt;/li&gt;
&lt;li&gt;SCHEMA NORMALIZATION&lt;/li&gt;
&lt;li&gt;FINAL SCHEMA DESIGN&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  1. PROBLEM AREA
&lt;/h4&gt;

&lt;p&gt;Design a relational database for a University to store records of timetables and keep proper track of students’ attendance.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. SCOPE OF WORK
&lt;/h4&gt;

&lt;p&gt;I have properly studied the case/problem, considering all the information provided and put in this report assumptions and limitations to the data model adopted in a bid to cater for real life scenarios even within the context of this work.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. RELATIONSHIPS
&lt;/h4&gt;

&lt;p&gt;In the ER Diagram below, there are relationships between entities which enforces the constraints on both sides of the relationship (side of Entity A, side of Entity B).&lt;/p&gt;

&lt;p&gt;The keys are as follows:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key cardinality&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1:1&lt;/td&gt;
&lt;td&gt;This is a one to one relationship between entities A and B, where one element of A can only be linked to one element of B and vice versa&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1:1..*&lt;/td&gt;
&lt;td&gt;This is a one to many relationship between entities A and B, where one element of A can be linked to many elements of B but a member of B is only linked to one element of A.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1..*:1..*&lt;/td&gt;
&lt;td&gt;Many to Many relationship, many elements of A can be linked to that of B and vice versa.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h4&gt;
  
  
  4.1 ENTITY RELATIONSHIP DIAGRAM
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbp6qd7urhcwxml6u40kt.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbp6qd7urhcwxml6u40kt.PNG" alt="Alt Text" width="800" height="920"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  4.2 ER Explanations and adequate assumptions:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;There is a one to many relationship between the School and Course Entities. This is on the premise that a school runs multiple courses. School_ID is the primary key in the school entity and a foreign key in the course entity while Course_ID is the primary key in the course table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There is a one to many relationship between the Course and Module Entities. This is from the case which states that a course contains multiple Modules. Course_ID and Module_Code are the primary keys of the course and module entities respectively and&lt;br&gt;
Course_ID is a foreign key in Module table for the relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The relationship between the Module and Session entities is a One to Many relationship. This is on the assumption that a module i.e CMM524 will constitute many sessions. Module_Code and Session_ID are the respective primary keys with Module_Code being the foreign key in Session table representing the relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Timetable required as in the case can be derived from the relationship between the primary (composite) keys in the School, Course, Semester and Module and Session entities. This will be discussed in more details later.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Course and Semester entities are on a one to many relationship. This has that one course can include one or many semesters. Course_ID and Semester_ID are the primary keys in their respective tables. Course_ID is a foreign key in semester to represent the one to many relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A one to many relationship also exists between the module and semester entities; thus stating that one module can be taught in many semesters. Module_Code and Semester_ID are the respective primary keys. Module_Code is another foreign key in the semester table based on the relationship. A Semester is assumed to be in the academic calender year i.e 1st Semester (01) runs from September to December, 2nd Semester (02) runs from January to May while 3rd Semester (03) runs from June to August.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There’s a one to many relationship between Course and Student entities signifying that a course can have many students enrolled into it and many students can enroll for a course. There are Student_ID and Course_ID as primary keys for both entities.&lt;br&gt;
Course_ID is the foreign key in student entity representing that relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A student will have different student IDs for undergraduate degree and post graduate programs. The Student ID for a particular student for undergraduate i.e. BSc Yoruba Engineering will be different for MSc and then PHD Yoruba Engineering.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An assumption was made in the Session Entity which has that the Room_No attribute values can point to which type of session is in the particular session’s room. This means that a particular Lecture Room number LTR_100 will be for lectures only as the prefix LTR points to a lecture room. Similarly, Tutorial Room (TTR_200) will be used for tutorial only as the TTR prefix is for tutorial rooms and Lab  Room (LBR_300) for laboratory purposes only as it the prefix LBR is for Lab rooms. The Room attribute value has a dual functionality in the table in identifying the Room number and the session type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There is a Many to Many relationship between Student and Session represented by the attends relationship. This has that many students can be a part of many sessions. Student_ID and Session_ID are the primary keys. The many to many relationship&lt;br&gt;
extends to a new table attendance which would contain the primary keys from the original tables as foreign keys. There is an attribute, attendance_record which would determine if the student attended the session or not. The attribute/column will have a Boolean data type (True or False) which would return True if the student attended the session or false if the student was absent.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  4C. ER LIMITATIONS
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;There is a possibility that the Course and Session entities have a many to many relationships. This will lead to a new table to be created in the physical schema design having the primary keys of both tables in it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the event that a lecture is taken in a Lab or Tutorial Room, this will render my assumption is point (9) above invalid. As an adjustment, the record that can be inserted into the table or record updated stating the Room_No = “Room number of room used” which would point to whether it was a Lecture, Lab or Tutorial&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  5. RELATIONAL TABLES
&lt;/h4&gt;

&lt;p&gt;After mapping the Entity Relationship Diagram above to relational tables, I have the following sets of tables and their mappings showing their relationship:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The School and Course tables showing the one to many relationship via the foreign key (School_ID).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fchasu6158wa8d143249v.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fchasu6158wa8d143249v.PNG" alt="Alt Text" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Course and Module tables showing the one to many relationship via the foreign key (Course_ID)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fctgwx2ol30q4sicrpf80.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fctgwx2ol30q4sicrpf80.PNG" alt="Alt Text" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Module and Session tables showing their one to many relationship via the foreign key (Module_Code).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqvnk5expdxodfw1nc8pr.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqvnk5expdxodfw1nc8pr.PNG" alt="Alt Text" width="800" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Course and Semester tables showing their one to many relationship via the foreign key (Course_ID)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0do3zps2p8molxzdv0vz.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0do3zps2p8molxzdv0vz.PNG" alt="Alt Text" width="800" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Module and Semester tables showing their one to many relationship via the foreign key (Module_Code)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F39y5qeeosclrtbwyhm5a.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F39y5qeeosclrtbwyhm5a.PNG" alt="Alt Text" width="800" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Course and Student tables showing their one to many relationship via the foreign key (Course_ID).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj4sm71o0phpg4jm9zuuj.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj4sm71o0phpg4jm9zuuj.PNG" alt="Alt Text" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Student and Session tables showing their many to many relationship via a new table ATTENDANCE, having the primary keys of both tables as composite keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6y357dl9x8sojauib78i.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6y357dl9x8sojauib78i.PNG" alt="Alt Text" width="699" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  6. SCHEMA NORMALIZATION
&lt;/h4&gt;

&lt;h5&gt;
  
  
  1. SCHOOL
&lt;/h5&gt;

&lt;p&gt;The School Table has a primary key School_ID which has one other attribute/column School_Name which is the name or a description of the different schools. A sample design of the Table is shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvcobpxj7ugqstogx18rg.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvcobpxj7ugqstogx18rg.PNG" alt="Alt Text" width="284" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For normalization, I have that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The School table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For 2NF, there’s a full functional dependency on School_ID from School_Name. The non-prime attribute School_Name is fully functionally dependent on the primary key School_ID as represented below.&lt;/p&gt;

&lt;p&gt;School_ID -&amp;gt; School_Name {full functional dependency}&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The table is in 3NF as there is no transitive dependencies on the primary key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  2. COURSE
&lt;/h5&gt;

&lt;p&gt;Based on my design, the Course table has a primary key, Course_ID uniquely identifying every module and another attribute Course_Name which gives a name or a brief description of each course. &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0rjgziqcv6ufuofydjk8.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0rjgziqcv6ufuofydjk8.PNG" alt="Alt Text" width="260" height="139"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For normalization, I have that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Course table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;For 2NF, there’s a full functional dependency on Course_ID from Course_Name. The non-prime attribute Course_Name is fully functionally dependent on the primary key Course_ID as represented below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Course_ID -&amp;gt; Course_Name {full functional dependency}&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 3NF as there is no transitive dependencies on the primary key.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. MODULE
&lt;/h4&gt;

&lt;p&gt;The Module entity like the two previously discussed, has a primary ID, Module_Code and one other attribute Module_Name showing the Names or descriptions of different modules.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4pgzs9yycjtetfhmtamg.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4pgzs9yycjtetfhmtamg.PNG" alt="Alt Text" width="264" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To show normalization on the Module Table:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 1NF as all attributes are atomic as in the design above.&lt;/li&gt;
&lt;li&gt;For 2NF, there’s a full functional dependency on Module_Code from Module_Name. The non-prime attribute Module_Name is fully functionally dependent on the primary key Module_Code as represented below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Module_Code &amp;gt; Module_Name {full functional dependency}&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 3NF as there is no transitive dependencies on the primary key&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  4. SESSION
&lt;/h4&gt;

&lt;p&gt;As I discussed earlier, my session table is going to be uniquely a user defined object table such that some columns(attributes) like the primary key (Session_ID) and Room_No which would naturally determine that type of session type it is (Lecture, Lab, Tutorial). &lt;/p&gt;

&lt;p&gt;The Session table has primary key Session_ID which uniquely identifies each record on the table considering the Room attribute can point to which session is holding in it. The session date and time specifies the date and time a session took or is to take place.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fftwqldaf2a73nl52j4li.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fftwqldaf2a73nl52j4li.PNG" alt="Alt Text" width="377" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To show normalization on the Session Table:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;For 2NF, there’s a full functional dependency of all the non-prime attributes on the
primary key. The non-prime attribute Room_No, Session_Date and Session_Time are
fully functionally dependent on the primary key Session_ID as represented below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Session_ID &amp;gt; Room_No {full functional dependency}&lt;/p&gt;

&lt;p&gt;Session_ID &amp;gt; Session_Date {full functional dependency}&lt;/p&gt;

&lt;p&gt;Session_ID &amp;gt; Session_Time {full functional dependency}&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 3NF as there is no transitive dependencies on the primary key&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  5. SEMESTER
&lt;/h4&gt;

&lt;p&gt;The semester table has a semester_ID that will uniquely identify each record on the table. The semester_year represents the year the semester is in and the semester_code represents the semester in that semester/school calendar year. An example can be semester&lt;br&gt;
ID SEMPLE03, which according to the table is year 2020 3rd Semester. To maintain the integrity of the schema, there’s a constraint that for a particular semester_year attribute (i.e.&lt;br&gt;
2019) will only have values (01,02,03). This is to maintain the integrity and avoid redundancies or/and data inconsistency. The variances for dates obtainable for each semester as in (6) of the assumption module of this document.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzbpkh4ze45lms5i5jb5v.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzbpkh4ze45lms5i5jb5v.PNG" alt="Alt Text" width="294" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For Normalization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 1NF as all attributes are atomic as in the design above.&lt;/li&gt;
&lt;li&gt;For 2NF, the 2 attributes are fully functionally dependent on the primary key and as
such meets the 2NF requirement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Semester_ID &amp;gt; Semester_Year {full functional dependency}&lt;/p&gt;

&lt;p&gt;Semester_ID &amp;gt; Semester_Code {full functional dependency}&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 3NF as there is no transitive dependencies on the primary key.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  6. STUDENT
&lt;/h4&gt;

&lt;p&gt;The Student table has a primary key Student_ID which is unique and a student_name attribute given the name of student. A schema sample is seen below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhxod2gksto43cer97tgi.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhxod2gksto43cer97tgi.PNG" alt="Alt Text" width="264" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To show normalization on the Student Table:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 1NF as all attributes are atomic as in the design above.&lt;/li&gt;
&lt;li&gt;For 2NF, there’s a full functional dependency on Student_ID from Student_Name. The non-prime attribute Student_Name is fully functionally dependent on the primary key Student_ID as represented below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Student_ID &amp;gt; Module_Name {full functional dependency}&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 3NF as there is no transitive dependencies on the primary key&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  7. ATTENDANCE
&lt;/h4&gt;

&lt;p&gt;The Attendance table is a result of a many to many relationship between the Student and Session tables. The table has a composite key comprising the Primary keys Student_ID and Session_ID has was from both related tables. There is another attribute, Attendance_Record which I assumed will form the basis of attendance. The column will have a Boolean data type which would contain the value “TRUE” if the Student attended and “FALSE” if the student didn’t attend.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8by6ih00crcvturj90hv.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8by6ih00crcvturj90hv.PNG" alt="Alt Text" width="366" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To show normalization on the Attendance sample Table:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 1NF as all attributes are atomic as sample.&lt;/li&gt;
&lt;li&gt;Attendance_Record has a full functional dependency on the composite keys hence the 2NF confirmation and as seen below:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Student_ID, Session_ID &amp;gt; Attendance_Record {full functional dependency}&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 3NF as there is no transitive dependencies on the composite keys&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Feavlxofko8vvtx71p7dw.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Feavlxofko8vvtx71p7dw.PNG" alt="Alt Text" width="800" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Attendance table will give the attendance record of a student for a particular session. A table that combines primary keys from the School, Course, Semester, Module and Session will supply the universities  timetable.&lt;/p&gt;

&lt;p&gt;Final Schema descriptions (Table Names, keys, columns and meanings) have been done in the Relational Tables &amp;amp; Schema Normalization portions of this document.&lt;/p&gt;

</description>
      <category>university</category>
      <category>database</category>
      <category>normalisation</category>
      <category>mysql</category>
    </item>
    <item>
      <title>Designing a Relational Database for Little Panda, a takeaway restaurant</title>
      <dc:creator>Arinze</dc:creator>
      <pubDate>Sun, 20 Dec 2020 18:14:36 +0000</pubDate>
      <link>https://forem.com/pocharis/designing-a-relational-database-for-little-panda-a-takeaway-restaurant-4m6j</link>
      <guid>https://forem.com/pocharis/designing-a-relational-database-for-little-panda-a-takeaway-restaurant-4m6j</guid>
      <description>&lt;h3&gt;
  
  
  Designing a Relational Database for Little Panda
&lt;/h3&gt;

&lt;p&gt;Little Panda is a takeaway who wants to open up its business to accept online orders. To do this, it needs a database to store its food menu, customer data and orders.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Requirements to design the relational database that runs on MySQL
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Customers must register before they can make orders. They must&lt;br&gt;
provide enough details for home delivery.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Menu item prices may change. Customers are charged prices at the&lt;br&gt;
time of order.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Little Panda needs to know the status of an order so that they can follow up. e.g. either it is “waiting to be cooked”, “cooked and to be delivered”, or delivered, etc. You can assume all orders are paid before they enter the&lt;br&gt;
system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Order details must be stored for accounting purpose, even after they are&lt;br&gt;
completed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Scope of Work and Defining Relationships
&lt;/h4&gt;

&lt;p&gt;Having considered the Little Panda case study and the requirements, I have come up with the following steps:&lt;br&gt;
    1. Design of the Entity Relation Diagram&lt;br&gt;
    2. Explaining the Design and stating assumptions&lt;br&gt;
    3. Stating Limitations where necessary&lt;br&gt;
    4. Defining Relationships Between Tables&lt;br&gt;
    5. Schema Normalization and Final Design&lt;/p&gt;

&lt;h4&gt;
  
  
  Relationships between entities
&lt;/h4&gt;

&lt;p&gt;From the ER derived based on the requirements, given entities A and B, the identified relationships between them are represented with the keys below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key cardinality&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1:1&lt;/td&gt;
&lt;td&gt;This is a one to one relationship between entities A and B, where one element of A can only be linked to one element of B and vice versa&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1:1..*&lt;/td&gt;
&lt;td&gt;This is a one to many relationship between entities A and B, where one element of A can be linked to many elements of B but a member of B is only linked to one element of A.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1..*:1..*&lt;/td&gt;
&lt;td&gt;Many to Many relationship, many elements of A can be linked to that of B and vice versa.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h5&gt;
  
  
  I. The Entity Relationship Diagram
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcx6r7r3x6rpnbsff1bfr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcx6r7r3x6rpnbsff1bfr.png" alt="Alt Text" width="800" height="725"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  II. Explaining the Design and Stating Assumptions
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;From the ER diagram, there is a one to many relationship between the customer and the payment entities. This is on the assumption that a customer can make many payments, but one payment cannot be linked to many customers. Customer_ID the primary key in the customer entity will be a secondary key in the payment entity, which has Payment_ID as primary key.&lt;/li&gt;
&lt;li&gt;Between the customer and order entities, there is a many to many relationship. This is based on the premise that a customer can place many orders and same type of order can belong to many customers. However, the address can be extended to a bridge table as a customer can place an order using more than one address. The Customer_ID and Order_ID are primary keys in their respective entities, but will be used as a foreign keys in the address table.&lt;/li&gt;
&lt;li&gt;The relationship between customer and order also on the premise that a customer can order for someone living in a different address different from the address used in registering.&lt;/li&gt;
&lt;li&gt;There is a many to many relationship between the order and menu
entities. This was derived from an order having many items from a menu and one item in a menu linked to more than one order. The Menu_ID and Order_ID are the primary keys in their respective entities. On the other hand, the order details can be used to bridge the two tables taking their respective primary keys as a foreign key.&lt;/li&gt;
&lt;li&gt;The order table has a status attribute which can be used to always know the point in the process where the order is.&lt;/li&gt;
&lt;li&gt;The order and payment entities are presumed to have a one to one relationship, as any payment made can only be linked to an order.&lt;/li&gt;
&lt;li&gt;An order from a customer can contain various items from the menu.&lt;/li&gt;
&lt;li&gt;The address of a customer contains the necessary information to deliver an order to the customer. &lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  III. Limitations Identified
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;The address of the customer is considered atomic and can be used to deliver to the required customer. &lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  IV. Defining Relationships between tables
&lt;/h4&gt;

&lt;p&gt;With the ER diagram defined in figure 1 above, this section is to show the sets of tables derived and their relationships.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The one to many relationship between customer and payment is shown below and respective primary and foreign keys assigned.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fremtt4dvozg83txt0sm8.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fremtt4dvozg83txt0sm8.PNG" alt="Alt Text" width="692" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The many to many relationship between the customer and order will be taken care of by adding an address table, because of the assumptions made.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3q7b6hc829ctk6xvunla.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3q7b6hc829ctk6xvunla.PNG" alt="Alt Text" width="710" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The one to one relationship between the payment and order entities are shown with the tables below. They have their respective primary keys, however the Order_ID is a foreign key in the payment table.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzzlrpl00qhs08l3v0an6.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzzlrpl00qhs08l3v0an6.PNG" alt="Alt Text" width="678" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The order and menu entities which are represented with a joint table, to account for the many to many relationship. The order details table will be used as joint table for this table and will contain primary keys of order and menu tables, as foreign keys. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5xd51pb4gh828arxftv6.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5xd51pb4gh828arxftv6.PNG" alt="Alt Text" width="711" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  V. Schema Normalization and Final Design
&lt;/h4&gt;

&lt;h5&gt;
  
  
  1. CUSTOMER
&lt;/h5&gt;

&lt;p&gt;From the customer table below, the Customer_ID is the primary key, where as the customer name, customer email and customer phone are other attributes. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmlnfl6nvtemy2eo2cjl6.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmlnfl6nvtemy2eo2cjl6.PNG" alt="Alt Text" width="423" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Customer Table Normalization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Customer table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For 2NF, there is a full functional dependency of Cusomer_Name,&lt;br&gt;
Customer_Email and Customer_Phone on the Customer_ID primary key. They are non-prime attributes which are fully functionally dependent on the primary key Customer_ID as represented below.&lt;/p&gt;

&lt;p&gt;Customer_ID-&amp;gt; Customer_Name {full functional dependency}&lt;/p&gt;

&lt;p&gt;Customer_ID-&amp;gt; Customer_Email {full functional dependency}&lt;/p&gt;

&lt;p&gt;Customer_ID-&amp;gt; Customer_Phone {full functional dependency}&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The table is in 3NF as there is no transitive dependencies on the primary key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  2. PAYMENT
&lt;/h5&gt;

&lt;p&gt;The payment table below has Payment_ID as the primary key. The&lt;br&gt;
Total_Amount, Payment_Datetime, Payment_Method are other dependent&lt;br&gt;
attributes. The Payment_ID uniquely identifies all the payment entries made&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq4lbcz53612l6zj2hrtk.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq4lbcz53612l6zj2hrtk.PNG" alt="Alt Text" width="567" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Payment Table Normalization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Payment table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For 2NF, there is a full functional dependency of Total_Amount,&lt;br&gt;
Payment_Datetime and Payment_Method on the Payment_ID primary key.&lt;br&gt;
They are non-prime attributes which are fully functionally dependent on the primary key Payment_ID as represented below.&lt;/p&gt;

&lt;p&gt;Payment_ID -&amp;gt; Total_Amount {full functional dependency}&lt;/p&gt;

&lt;p&gt;Payment_ID -&amp;gt; Payment_Datetime {full functional dependency}&lt;/p&gt;

&lt;p&gt;Payment_ID -&amp;gt; Payment_Method {full functional dependency}&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The table is in 3NF as there is no transitive dependencies on the primary key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  3. ORDER
&lt;/h5&gt;

&lt;p&gt;The order table below has Order_ID as the primary key. The Order_Datetime and Order_Status are other dependent attributes. The Order_ID uniquely identifies all the order entries made. On the other hand, an order details table will be subsequently introduced, to identify the link to content of each order&lt;br&gt;
made.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi5n1qm4cacsdomyafi6d.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi5n1qm4cacsdomyafi6d.PNG" alt="Alt Text" width="419" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Order Table Normalization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Order table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For 2NF, there is a full functional dependency of Order_Datetime and Order_Status on the Order_ID primary key. They are non-prime attributes which are fully functionally dependent on the primary key Order_ID as represented below.&lt;/p&gt;

&lt;p&gt;Order_ID Order_Datetime {full functional dependency}&lt;/p&gt;

&lt;p&gt;Order_ID Order_Status {full functional dependency}&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The table is in 3NF as there is no transitive dependencies on the primary key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  4. ADDRESS
&lt;/h5&gt;

&lt;p&gt;There is an assumption that a customer can order to multiple address at different point in time. The address table will be used to identify a customer’s order, with their respective address. The Customer_ID and Order_ID are the composite keys from the customer and order tables, where they serve as primary keys.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvdt47xx71uyr65w3t79a.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvdt47xx71uyr65w3t79a.PNG" alt="Alt Text" width="381" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Address Table Normalization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Address table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;For 2NF, there is a full functional dependency of Address_Line on the composite keys, as shown below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Customer_ID, Order_ID -&amp;gt;  Address_Line {full functional dependency}&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The table is in 3NF as there is no transitive dependencies on the primary key&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  5. ORDER DETAIL
&lt;/h5&gt;

&lt;p&gt;The order detail table is a joint table between the order and menu tables. The Order_Quantity and Total_Price are dependent on the Order_ID and Menu_ID which are composite keys.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fskgdirbbx4d5pjs9jby8.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fskgdirbbx4d5pjs9jby8.PNG" alt="Alt Text" width="440" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Address Table Normalization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Order table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For 2NF, there is a full functional dependency of Order_Quantity and Total_Price on the composite keys, as shown below.&lt;/p&gt;

&lt;p&gt;Order_ID, Menu_ID -&amp;gt;  Order_Quantity {full functional dependency}&lt;br&gt;
 Order_ID, Menu_ID -&amp;gt;  Total_Price {full functional dependency}&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The table is in 3NF as there is no transitive dependencies on the primary key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  6. MENU
&lt;/h5&gt;

&lt;p&gt;The menu table below has Menu_ID as the primary key. The Menu_Name, Menu_Price and Menu_Description are other dependent attributes. The Menu_ID uniquely identifies each menu item.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6kra6z0cyralnat5qczy.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6kra6z0cyralnat5qczy.PNG" alt="Alt Text" width="423" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Payment Table Normalization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Menu table is in 1NF as all attributes are atomic.&lt;/li&gt;
&lt;li&gt;For 2NF, there is a full functional dependency of Menu_Name, Menu_Price and Menu_Description on the Menu_ID primary key. They are non-prime attributes which are fully functionally dependent on the primary key Menu_ID as represented below.
Menu_ID -&amp;gt; Menu_Name {full functional dependency}
Menu_ID -&amp;gt; Menu_Price {full functional dependency}
Menu_ID -&amp;gt; Menu_Description {full functional dependency}&lt;/li&gt;
&lt;li&gt;The table is in 3NF as there is no transitive dependencies on the primary key.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The final design schema in figure 2 below, shows the identified and normalized tables with their various primary keys and attributes. &lt;/p&gt;

&lt;h5&gt;
  
  
  FINAL SCHEMA DESIGN
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmno70qdps77ea5bls0de.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmno70qdps77ea5bls0de.PNG" alt="Alt Text" width="666" height="713"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to leave a comment on any part of the document that interests you.&lt;/p&gt;

</description>
      <category>database</category>
      <category>erdiagram</category>
      <category>normalization</category>
      <category>3nf</category>
    </item>
  </channel>
</rss>
