Computed columns it self does not contain any data, but shows value based on expression (given formula). Its very simple to add a computed columns in SQL Server you can either add them through DDL query or through SSMS GUI.
- Computed columns actually are virtual columns
- Are not physically stored in the table unless the column is marked PERSISTED.
- If NOT PERSISTED: Values for computed columns are recalculated every time they are referenced in a query.
- If PERSISTED: Values of computed column are updated when any columns that are part of their calculation change.
- By marking a computed column as PERSISTED, we can create an index on a computed column.
- Computed columns used as CHECK, FOREIGN KEY, or NOT NULL constraints must be marked PERSISTED.
Please go through following video tutorial for better understanding.
Hindi / Urdu Version: