Selecting Specific Columns
While SELECT * is convenient, it's often better to specify exactly which columns you need. This makes your queries clearer and can improve performance.
Selecting One Column
SELECT column_name FROM table_name;
Selecting Multiple Columns
Separate column names with commas:
SELECT column1, column2, column3 FROM table_name;
Exercises
Loading exercise...
Loading exercise...
Loading exercise...
Loading exercise...
Why Specify Columns?
There are several reasons to list specific columns instead of using *:
- Clarity: Your query shows exactly what data you need
- Performance: The database only fetches the columns you request
- Stability: If the table structure changes, your query still works
- Documentation: Other developers can understand your intent
Free Practice
Loading SQL editor...
Try selecting different combinations:
- Just
idandcreated_at - All columns related to location (
city) - All columns related to the person (
name,age)

