title: Add a new column to a view in SQL
body: <p>This is my view</p>
  
  <pre><code>CREATE VIEW seat_availability AS
  SELECT flightid,flightdate, maxcapacity,
  FROM flight
  </code></pre>
  
  <p>And I want to add 2 new columns named 'bookedseats' and 'availableseats' which don't exist in any tables but are columns I need to add. </p>
  
  <p>I've done my research online and some say you can alter views by using:</p>
  
  <pre><code>ALTER VIEW 
  </code></pre>
  
  <p>And some have said that you can't do that and have to edit from the view you've just created. </p>
  
  <p>I've tried this:</p>
  
  <pre><code>CREATE VIEW seat_availability AS
  SELECT flightid,flightdate, maxcapacity, bookedseats varchar(10), availableseats varchar(10)
  FROM flight
  </code></pre>
  
  <p>which gave this error:</p>
  
  <blockquote>
    <p>ERROR:  syntax error at or near "varchar" LINE 2: ...ECT
    flightid,flightdate, maxcapacity, bookedseats varchar(10...</p>
  </blockquote>
  
  <p>I've also tried ALTER VIEW:</p>
  
  <pre><code>ALTER VIEW seat_availability AS
  SELECT flightid,flightdate, maxcapacity, bookedseats varchar(10), availableseats varchar(10)
  FROM flight
  </code></pre>
  
  <p>And I got this error:</p>
  
  <blockquote>
    <p>ERROR:  syntax error at or near "AS" LINE 1: ALTER VIEW
    seat_availability AS</p>
  </blockquote>
  
  <p>It would be easy to add columns if they existed in other tables but because I need to add 2 columns that don't exist in any table, it's proving difficult to do. If someone could help it would be very appreciated. Thank you. </p>
  
  <p>Perhaps I may need to drop the view? and start again with two new columns added but how do I add them since they don't exist in any table in my database??</p>