title: What to use in order to have full consolidated table in Mysql
body: <p>I am creating two tables .</p>
  
  <p>Table 1 has following schema</p>
  
  <pre><code>user_id       int            not null,autoincrement
  movie _id     int            not null 
  movie_name    varchar        
  user_name     varchar
  rating        int
  genre         varchar
  </code></pre>
  
  <p>while table 2 has following schema</p>
  
  <pre><code>movie _id     int            not null 
  movie_name    varchar        
  user_name     varchar
  genre         varchar
  rating        varchar
  </code></pre>
  
  <p>Now when I put a query to insert values it first checks whether a following username exist in first table .If true then it inserts into second table otherwise it inserts value as per schema into first table.In other words first table has unique usernames and unique user_Id while second contains many repeated usernames with movie they have seen</p>
  
  <p>So there are following values which I am inserting via form(Java ,servlet) into my tables </p>
  
  <pre><code>user_Id    movie_Id    movie_name      user_name   rating  genre
  1           1           Twister         Alex          6      Drama
  2           1           Twister         Tim           1      Drama
  3           2           sweet november  pam           5      Romantic
  4           3           The pianist     carl          5      Drama 
  5           4           narnia          stephen       7      Fantasy   
  ..
  ..
  (contd..)
  </code></pre>
  
  <p>Table 2</p>
  
  <pre><code>    movie_Id   movie_Name    user_name     genre     Rating
      2          sweet november  Alex        Romantic    4
      3          The pianist     Alex        Drama       5
      4          narnia          Pam         Fantasy     8
      9          maceth          Tim         Drama       9
      ..
      ....
  
  (contd.)
  </code></pre>
  
  <p>..
  .Further I want to merge both the tables so that it gives me the following image</p>
  
  <pre><code>user_id   movie_Id  movie_name      user_name   rating  genre
  1         1         Twister            Alex        6      Drama
  1         2         sweet november     Alex        4      Romantic
  1         3         The pianist        Alex        5      Drama
  2         1         Twister            Tim         1      Drama
  2         9         macbeth            Tim         9      Drama
  3         2         Sweet November     Pam         5      Romatic
  3         4         Narnia             Pam         8      Fantasy
  4         3         The Pianist        Carl        5      Drama
  5         4         Narnia             Stephen     7      Fantasy
  ... and so on 
  
  What should I use
  </code></pre>
  
  <p>I tried with join but it neglects first table value.I want to have both table values just after i enter values in form and then i click</p>
  
  <p>This is following syntax which i was using</p>
  
  <pre><code>select * from table2 inner join table1 on table2.user_name = table1.user_name
  </code></pre>
  
  <p>Please suggest something</p>
  
  <p>Thanks</p>