Select All Columns from a SQL Table: How SELECT * Works and When to List Columns Instead

How to select all columns from a SQL table with SELECT *, what it changes and what it does not, and when an explicit column list is the safer choice.

Selecting every column from a SQL table is usually the first query people write and one of the first habits they are later told to drop. This review covers what the asterisk shorthand does, what it leaves unchanged, and how to decide whether it fits your purpose or whether naming the columns explicitly is better.

The basic syntax

In standard SQL, the asterisk in the select list means "every column of the tables in the FROM clause." The minimal form looks like this:

SELECT *
FROM customers;

When a query joins several tables, you can limit the asterisk to one of them by qualifying it with the table name or alias:

SELECT o.*, c.name
FROM orders AS o
JOIN customers AS c
  ON c.id = o.customer_id;

The explicit alternative names each column you want, in the order you want it returned:

SELECT id, name, email, created_at
FROM customers;

Is SELECT * suitable for your use?

Recommendation: use SELECT * for interactive exploration, quick inspection of an unfamiliar table, and one-off checks. Prefer an explicit column list in application code, views, reports, scheduled exports and anything another person or program depends on.

The main benefit is speed and completeness. You do not need to know the schema in advance, and you will not accidentally leave out a column while investigating data.

The decisive tradeoff is that the result shape is controlled by the table definition rather than by your query. If someone adds, removes, renames or reorders columns, a SELECT * query silently returns something different. Code that reads columns by position, inserts the result into another table, or writes a fixed-layout file can break or, worse, keep running with misaligned data.

  • Situations where an explicit column list is the better choice:
  • Production application queries and stored procedures
  • INSERT INTO ... SELECT statements, where column count and order must match the target
  • Views that other queries or tools build on
  • Exports to CSV or other delimited files consumed by downstream systems
  • Tables that contain large text or binary columns you do not need
  • Tables with sensitive columns that should not travel further than necessary
  • Joins where several tables share column names such as id or created_at

What SELECT * actually changes

Despite the topic sometimes being filed under text or column transformation tools, SELECT * does not transform stored data. It is a projection: it chooses which columns appear in the result set. The rows, the values and the table itself are unchanged. Nothing is reversed, restyled or rewritten; the query only reads.

What it does determine is the shape of the output. Columns are returned in the order defined by the table, and in a join the columns of each table appear together, following the table order in the FROM clause. If two joined tables both have a column called id, the result contains two columns with the same name. Some client tools and drivers handle this by renaming or overwriting one of them, so the behavior depends on the tool rather than on SQL itself.

"All columns" can also be less literal than it sounds. Some database systems support columns that are deliberately left out of SELECT * unless named, such as invisible or hidden columns. Whether this applies depends on the specific database and how the table was created, so check your system's documentation if a column you expect does not appear.

Selecting all columns except a few

Standard SQL has no portable way to say "every column except these." Some systems offer non-standard extensions with keywords such as EXCEPT or EXCLUDE inside the select list, but the syntax and availability differ between products and versions. Confirm support in your database's documentation before relying on it, and expect such a query not to run unchanged elsewhere.

A portable workaround is to list the table's columns from the metadata catalog and then copy the names you want into an explicit select list. Many databases expose this through information_schema:

SELECT column_name
FROM information_schema.columns
WHERE table_name = 'customers'
ORDER BY ordinal_position;

Depending on the system, you may also need to filter by schema, and the exact catalog views and case sensitivity of names vary.

Performance considerations

Returning every column means the database reads, and the network carries, data you may not use. The cost depends heavily on the table, the storage format and the query plan, so no general figure applies. In broad terms, the difference matters most with wide tables, large text or binary columns, columnar storage where unrequested columns might otherwise be skipped, and queries that could have been answered from an index alone if only indexed columns were requested. No measurements were supplied for this review, so test against your own data if performance is the deciding factor.

Will the result stay usable after copying or sharing?

A common next step after selecting all columns is copying the result grid into a spreadsheet, a message or a delimited text file. The query is not the weak point here; the hand-off is.

  • Points to check when moving results as delimited text:
  • Values containing the delimiter, quotes or line breaks need proper quoting, or the columns will shift when the text is parsed again
  • NULL may be exported as an empty field, the word NULL or something else, depending on the tool, and an empty string can become indistinguishable from NULL
  • Spreadsheets may reinterpret values on import, for example by dropping leading zeros from codes or reformatting dates and long numbers
  • Duplicate column names from a join can make headers ambiguous for the next reader or program
  • Character encoding must match between export and import, or non-ASCII text may be garbled
  • Copying from a result grid may include or omit headers depending on the client's settings

Because SELECT * makes the column set depend on the current schema, a file exported today may have a different layout from one exported after a schema change. If a recipient or script expects a fixed set of columns, an explicit list keeps the output stable.

For accessibility, wide results are harder to read and navigate, especially when shared as a pasted grid or a long line of delimited text. A shorter, explicitly ordered set of clearly named columns, presented as a properly structured table with a header row, is generally easier to follow. How a particular screen reader or destination handles pasted tables was not tested for this review, so verify in the environment where the data will actually be read.

Gaps in this review

No product-specific evidence, benchmarks or tool tests were supplied. Statements here reflect general, documented SQL behavior. Dialect-specific features, hidden-column behavior, export formatting and performance differences should be confirmed against your own database version and client tools.

Bottom line

SELECT * FROM table_name is the quickest way to see every column, and it is safe in the sense that it only reads data. Use it to explore. When the output feeds code, files, reports or other people, name the columns so the result keeps the same shape, carries only what is needed and remains readable after it leaves the database.