SQL Add Column: ALTER TABLE Guide
To add a new column to an existing table, you can use the ALTER TABLE statement.
For example, suppose we have a table called students and we want to add a column called age to the table, we can use the following SQL statement:
ALTER TABLE students
ADD COLUMN age INT;
The above SQL statement is adding an integer type column named age to the students table. You can also specify the data type, constraints, etc. for the column as needed.
In addition, to set a default value in a new column, you can use the following SQL statement:
ALTER TABLE students
ADD COLUMN age INT DEFAULT 0;
This will set the default value to 0 in the age column.