title: Creating a MySQL view with an auto-incrementing id column
body: <p>I have a MySQL database from which a view is created. Is is possible to add an auto-incrementing id for each row in the view?</p>
  
  <p>I tried</p>
  
  <pre><code>CREATE ALGORITHM=UNDEFINED DEFINER=`database_name`@`%` SQL SECURITY DEFINER VIEW `MyView` AS 
  set @i = 0;
  select  @i:=@i+1 as `id`
          ...
  </code></pre>
  
  <p>but that doesn't work in a View.</p>