title: How to insert 365 rows and increment date by one day for each row
body: <p>I have a table with the schema like this:</p>
  <pre><code>date | from_city | to_city | rate_per_mile 
  </code></pre>
  <p>I want to insert today's rate for a city pair (city1, city2, rate) and create 365 rows for all days starting from today until the next 365 days.</p>
  <pre><code>date                   | from_city | to_city | rate_per_mile 
  -------------------------------------------------------------
  DATE(NOW())            | city1     | city2   | 13.23
  DATE(NOW()) + 1 day    | city1     | city2   | 13.23
  DATE(NOW()) + 2 days   | city1     | city2   | 13.23
  DATE(NOW()) + 3 days   | city1     | city2   | 13.23
  ...
  DATE(NOW()) + 365 days | city1     | city2   | 13.23
  </code></pre>
  <p><code>(date, from_city, to_city)</code> is the primary key for the table, and I would be updating the table every day, so if a row already exists for the key, it should be replaced.</p>
  <p>What is the best possible way to do these insert/updates? Worst case since I have to do this from a java program, I'll have to create 365 rows and do a big bulk insert:</p>
  <pre><code>INSERT INTO my_table
  VALUES 
    (DATE(NOW()), city1, city2, 13.23),
    (DATE(NOW() + INTERVAL '1' day), city1, city2, 13.23),
    (DATE(NOW() + INTERVAL '2' day), city1, city2, 13.23),
    ...
  </code></pre>
  <p>Questions:</p>
  <ol>
  <li>What is the best way to do this?</li>
  <li>In such situations, can I avoid these inserts and create views instead that would return the latest available date projected for next 365 days for each city pair? How to create such a view?</li>
  </ol>