Add new column to a table
ALTER TABLE (Transact-SQL)
Modifies a table definition by altering, adding, or dropping columns and constraints. ALTER TABLE also reassigns and rebuilds partitions, or disables and enables constraints and triggers.
For more information about the syntax conventions, see Transact-SQL Syntax Conventions.
Take a look at this if you want to know more about altering statements in SQL. https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver15
If we need to add a new column to our table however such a new table needs to calculate something, we can ask SQL to do it for us. Just like the following example:
So we can now calculate the value thanks to SQL.
Last updated