Introduction
This article breaks down the core building blocks of SQL:
What SQL really is
Understanding SELECT and FROM
Filtering data using WHERE
Sorting results using ORDER BY
Limiting result sets efficiently
What is SQL?
SQL (Structured Query Language) is the standard language used to communicate with relational databases.
It allows you to:
Retrieve data
Insert new records
Update existing records
Delete records
Manage database structure
SQL does not store data itself. Instead, it interacts with a database system such as SQL Server, MySQL, PostgreSQL, or Oracle.
What is a Database?
A database is an organized collection of data. Think of it as a digital storage system that keeps structured information.
For example:
Employee records
Customer details
Orders and transactions
What is a Table?
Inside a database, data is stored in tables.
A table consists of:
Rows (records)
Columns (fields)
Example table: Employees
| EmployeeID | FirstName | LastName | Company |
|---|---|---|---|
| 1 | John | Smith | ABC Corp |
| 2 | Sarah | Lee | XYZ Ltd |
Each row represents one employee.
Each column represents a specific attribute.
Now let’s query this table.
A. Understanding SELECT and FROM
The most fundamental SQL command is SELECT.
Basic Syntax
SELECT column_name FROM table_name;
What Each Keyword Means
SELECT → Specifies what data you want
FROM → Specifies where the data is coming from
It is essentially saying: “Give me these particular columns from this table.”
Example 1: Selecting Specific Columns
SELECT FirstName, LastName FROM Employees;
What this does:
Retrieves only FirstName and LastName
Ignores other columns
Returns all rows
Result:
| FirstName | LastName |
|---|---|
| John | Smith |
| Sarah | Lee |
Example 2: Selecting All Columns
SELECT * FROM Employees;
The * means “Select Everything.”
However, in real-world applications, using SELECT * is not recommended because:
It retrieves unnecessary data
It reduces performance
It increases network load
Best practice: Always select only required columns.
B. Understanding WHERE (Filtering Data)
Retrieving all records is rarely useful. Most real queries require filtering.
The WHERE clause allows you to filter rows based on conditions.
Basic Syntax
SELECT column_name FROM table_name WHERE condition;

Join the conversation! Your thoughts help the community grow.