How to change column name in SQL? I have tried the following but giving a syntax error.
create view cView as select * from College;
alter table cView
rename cName to collegeName,
rename enrollment to seats;
You can't directly rename columns in a view, but you can recreate it with the new names you want:
CREATE OR REPLACE cView AS
SELECT col1,
col2,
cName AS collageName,
enrollment AS seat,
someOtherColumn
-- etc...
FROM myTable