---
title: "select * in SQL transformation files | Metacenta"
description: "For SQL projects without dbt: which files write a table or view from an unbounded select *, why it matters, and which views we leave alone."
url: "https://metacenta.com/rules/sql-select-star-output"
updated: "2026-10-14"
tokens: 573
---

Maintainability · rule sql-select-star-output

# select * in SQL transformation files

A Metacenta review checks this under the rule **SQL files select explicit columns**. Everything below applies whether or not you ever commission one.

## What this rule checks

For SQL projects without dbt, this rule flags files that write a table or view whose output reaches an upstream relation through `*`. A `*` over a CTE that lists its columns passes. A view that only mirrors one table, with no join, is left alone.

## Why it matters

A column added upstream appears here without a code change, and a renamed one disappears without an error. Readers of the table see the change before anyone has reviewed it.

## How to fix it

**List columns instead of select * in the SQL.** List the columns in the statement that writes the relation. A view that deliberately mirrors one table can keep `*`; say so in the file.

Before:

```sql
create or replace table analytics.orders as
select *
from raw.shop_orders
where status != 'test';
```

After:

```sql
create or replace table analytics.orders as
select order_id, customer_id, ordered_at, status
from raw.shop_orders
where status != 'test';
```

## When it is fine to leave

A table that must carry every column of its source, such as a raw landing copy, is correct to use `*`. A mirroring view with more than one statement is not recognised as one, so tell us and the finding comes out of your report.

## What we need to check it

The `.sql` files, read from your repository with read-only access or uploaded. We keep only relation names, counts and a fingerprint per file, so the finding is medium confidence.

[Ask about a review](https://metacenta.com/enquire?src=rule-sql-select-star-output&via=md)

## Related pages

- [Duplicate logic across dbt models](https://metacenta.com/rules/duplicate-model-logic)
- [select * in dbt models](https://metacenta.com/rules/select-star)
- [dbt models with too many CTEs](https://metacenta.com/rules/high-cte-count)
- [dbt layer naming: inconsistent model prefixes](https://metacenta.com/rules/layer-naming-mismatch)
- [A sample review, as a client reads it](https://metacenta.com/sample)
- [All published rules](https://metacenta.com/rules)
- [How a review is assessed](https://metacenta.com/standard)
