0
0
SQLquery~5 mins

SELECT all columns in SQL

Choose your learning style9 modes available
Introduction

We use SELECT all columns to get every piece of information from a table without listing each column name.

You want to see all details about customers in a customer table.
You need to check all data in a product list quickly.
You are exploring a new table and want to understand what data it holds.
You want to export all information from a table to another system.
You want to debug or verify all columns in a table.
Syntax
SQL
SELECT * FROM table_name;

The asterisk (*) means 'all columns'.

Replace table_name with the actual name of your table.

Examples
This gets all columns and rows from the employees table.
SQL
SELECT * FROM employees;
This gets all columns but only for orders made on January 1, 2024.
SQL
SELECT * FROM orders WHERE order_date = '2024-01-01';
This gets all columns but only the first 5 rows from the products table.
SQL
SELECT * FROM products LIMIT 5;
Sample Program

This creates a simple table called fruits, adds three rows, then selects all columns and rows.

SQL
CREATE TABLE fruits (id INT, name VARCHAR(20), color VARCHAR(20));
INSERT INTO fruits VALUES (1, 'Apple', 'Red'), (2, 'Banana', 'Yellow'), (3, 'Grape', 'Purple');
SELECT * FROM fruits;
OutputSuccess
Important Notes

Using SELECT * is easy but can be inefficient if the table has many columns and you only need a few.

Always consider listing columns explicitly in large or production queries for better performance and clarity.

Summary

SELECT * fetches all columns from a table.

It is useful for quick checks or when you need every piece of data.

Use it carefully in big tables to avoid slow queries.