BEGINNER
⏱ 15 minutes
SELECT Basics - SQL Fundamentals
Learn the foundation of SQL queries with the SELECT statement. This is where every SQL journey begins!
What You'll Learn
- Understanding the SELECT statement
- Retrieving data from tables
- Selecting specific columns
- Using SELECT * (all columns)
- Basic query structure
1. Introduction to SELECT
The SELECT statement is the most fundamental SQL command. It allows you to retrieve data from one or more tables in your database.
Basic Syntax
SELECT column1, column2, ...
FROM table_name;
2. Selecting All Columns
Use the asterisk (*) to select all columns from a table:
SELECT * FROM students;
3. Selecting Specific Columns
To retrieve only specific columns, list them separated by commas:
SELECT name, email FROM students;
4. Practice Exercise
Try it yourself: Write a SELECT statement to retrieve the name and major columns from the students table.
Key Takeaways
- SELECT is used to query data from tables
- Use * to select all columns
- List specific column names for selective retrieval
- Always end queries with a semicolon (;)