Search code examples
mysqlnormalization

How to check in mysql that normalized table is ok or not in mysql


MY base table have two colums assume col1,col2. col1 have id, col2 have many comma seprated values colm1 is primary key. like

  col1        col2
 ---------------------
  123        (22,34,12)
  124        (45,67,11)

Now i have another table which is in normalized form of the first one like

col1     col2
---------------
123       22 
123       34
123       12
124       45 
124       67

Now the question is that i want to check that my second table have exect data of first table or not. And if not then how to find that error.

( i need to show the extra row of second table and missing row of second table seperately )


Solution

  • Thanx to everbody for suggestions. I got my solution through this query

    select * table1 as a join table2 as b on a.col1=b.col1 where a.col2 not like concat('%',b.col2,'%')