Page 181 - Data Science class 10
P. 181

There are many places where these data merging procedures will help you. For example, if you have two different
            systems that work in parallel with each other. Suppose you have to do some analysis of the relationship where you
            have a legacy system with very poorly formatted data that you are willing to integrate with your new system. This
            is where data merging comes into the picture. Let us now learn more about data merging techniques.


            4.2. DATA JOINS

            We can merge data by applying data joins on the databases in frame. There are three types of data joins which are
            as follows:

               • One to one Join
               • One to many Join
               • Many to many Join
               • One to One Join: It is used to create a join between two tables in which a single row of the first table can only
              be linked to one and only one row of the second table. In the same way, the row of the second table can also be
              linked to any row of the first table. In this join, both tables must have primary key columns. It occurs when there
              is exactly one record in Table A that corresponds to exactly one record in Table B.
                                Customer (Table A)                              Order (Table B)
                                Rohan                                              Ord 101
                                Viraj                                              Ord 102
                                Ananya                                             Ord 103
                                Divya                                              Ord 105
                                Suraj                                              Ord 107
                                Vishal                                             Ord 108
                                Anaya                                              Ord 109
                                Aarush                                             Ord 110

               • One to Many Join: It is used to create a join between two tables. Any single row of the first table can be linked
              to one or more rows of the second table, but the rows of the second table can only link to the only row in the
              first table. It is also known as a many to one join.
            In this join, one of the tables must have a primary key column that will be associated with all the columns of related
            tables. It occurs when each record in Table A can have many linked records in Table B but each record in Table B
            may have only one corresponding record in Table A.
            Representation of One to Many relational databases:
                      Person (Table A)              Games (Table B)

                                Rohan                                               Cricket
                                Viraj                                              Football
                                Ananya                                              Tennis
                                Divya                                              Volleyball
                                Suraj                                               Carrom
                                Vishal                                             Bowling
                                Anaya                                               Boxing
                                Aarush                                            Basketball
               • Many to Many Join: It is many to many joins that create a link between two tables. Each row of the first table
              can link to any row (or no row) in the second table. In the same way, each row of the second table can also link
              to more than one row of the first table. It is also represented as an N:N relationship.


                                                                                               Data Merging    179
   176   177   178   179   180   181   182   183   184   185   186