Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Back to SQL Notes
Topic #201

SQL SELECT Statement

SELECT retrieves data from one or more tables. It's the statement you'll write more than any other in SQL.

Syntax

SELECT column1, column2
FROM table_name;

-- every column
SELECT * FROM table_name;

Sample Table: employees

idnamedepartmentsalary
1AmanEngineering65000
2RiyaMarketing52000
3KaranEngineering71000

Example

SELECT name, department
FROM employees;

Output:

namedepartment
AmanEngineering
RiyaMarketing
KaranEngineering

Why Not Always Use SELECT *?

SELECT * is convenient while exploring data, but in real applications it's usually avoided: it pulls columns you don't need (wasting bandwidth and memory), and it silently breaks if the table's columns change later. Naming columns explicitly is the professional default.

Computed Columns

SELECT name, salary, salary * 12 AS annual_salary
FROM employees;

You can select expressions, not just raw columns — covered further in Aliases.

Common Mistakes

  • Using SELECT * in production application code instead of named columns
  • Forgetting that SELECT alone doesn't filter or sort — that's WHERE and ORDER BY

Interview Relevance

The very first thing most SQL interviews check is whether you can write a clean, correctly-scoped SELECT — get comfortable with it before anything else.

Practice Question

Write a query that selects each employee's name and their salary expressed as a monthly figure, assuming salary stores an annual value.

Related SQL Notes

Want to go beyond the notes?

Join CodingNow's SQL course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →