this view
create view seat_availability select flightid,flightdate, maxcapacity, flight
and want add 2 new columns named 'bookedseats' , 'availableseats' don't exist in tables columns need add.
i've done research online , can alter views using:
alter view
and have said can't , have edit view you've created.
i've tried this:
create view seat_availability select flightid,flightdate, maxcapacity, bookedseats varchar(10), availableseats varchar(10) flight
which gave error:
error: syntax error @ or near "varchar" line 2: ...ect flightid,flightdate, maxcapacity, bookedseats varchar(10...
i've tried alter view:
alter view seat_availability select flightid,flightdate, maxcapacity, bookedseats varchar(10), availableseats varchar(10) flight
and got error:
error: syntax error @ or near "as" line 1: alter view seat_availability as
it easy add columns if existed in other tables because need add 2 columns don't exist in table, it's proving difficult do. if appreciated. thank you.
perhaps may need drop view? , start again 2 new columns added how add them since don't exist in table in database??
you don't define datatype of column that. let view use underlying datatype this.
alter view seat_availability select flightid , flightdate , maxcapacity , bookedseats , availableseats flight
or if need explicitly change datatype need use convert this.
alter view seat_availability select flightid , flightdate , maxcapacity , bookedseats = convert(varchar(10), bookedseats) , availableseats = convert(varchar(10), availableseats) flight
Comments
Post a Comment