> For the complete documentation index, see [llms.txt](https://docs.dwh.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dwh.dev/features/data-lineage/default-and-virtual-columns.md).

# Default and Virtual Columns

[**Youtube**](https://youtu.be/eLi8CnXP8LA)

**Default and Virtual Columns** also contain information about data lineage. And as usual, nobody pays attention to it :)

```sql
-- default value
CREATE TABLE t1 (
  id1 int,
  id2 int default (id1 +1)
);

CREATE VIEW v1 AS
  SELECT *
  FROM t1
;
```

If during data transformations, only the id1 column is inserted into the **T1** table, the lineage information will be lost.

At [**Dwh.dev**](https://dwh.dev/), we display it like this:

<figure><img src="https://2021384124-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa2Ggnf05SJ2216hdw5Fb%2Fuploads%2FXrzYM5zQc559xhV1BaSi%2Fimage.png?alt=media&amp;token=09c92e1f-4372-4a40-8852-e1bf505c8da5" alt=""><figcaption></figcaption></figure>

With **Virtual columns**, an even more precarious situation arises. It's impossible to insert data into a virtual column, and they will ALWAYS depend on other columns in the table.

```sql
-- virtual column
CREATE TABLE T2 (
  A INT,
  B INT,
  C INT,
  D INT AS (CASE WHEN A>0 THEN B ELSE C END)
);

CREATE VIEW v2 AS
  SELECT *
  FROM t2
;
```

At [**Dwh.dev**](https://dwh.dev/), we display it like this:&#x20;

<figure><img src="https://2021384124-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa2Ggnf05SJ2216hdw5Fb%2Fuploads%2FFt2BPxWCNP5lZaS1Tej9%2Fimage.png?alt=media&amp;token=3f5bcb71-1b56-4013-853f-c4aaa12a0aac" alt=""><figcaption></figcaption></figure>
