SQL

Avoid SELECT *

Query Efficiency: Select Only What You Need

The Problem with SELECT *

SELECT * retrieves ALL columns, even ones you don't need:

  • More data transferred
  • More memory used
  • Harder to read and maintain
  • Can break code if schema changes

Better Practice

Always specify the exact columns you need:

-- Instead of: SELECT * FROM users
SELECT id, username, email FROM users

Your Task

You need to create a user list showing only:

  • username, email, created_at

Write an efficient query using only these columns (not SELECT *).

query.sql
Loading SQL engine...
Downloading SQL engine… (one-time)

Downloading SQL engine… (one-time)

This runs entirely in your browser and is cached for next time.