Introduction

Introduction to SQL Lesson Goal
In this lesson, you will learn:
What SQL is
Why SQL is important
Where SQL is used in the real world
How to write your first basic SQL query
Introduction
SQL is the foundation of working with data. Almost every application you use today—websites, mobile apps, banking systems—relies on databases, and SQL is the language used to talk to those databases.
If you want to work with data, backend systems, analytics, or data engineering, SQL is non-negotiable.
What is SQL?
SQL (Structured Query Language) is a standard language used to:
Store data in databases
Retrieve data from databases
Update existing data
Delete data when required
SQL works with relational databases where data is stored in tables (rows and columns).
::: SQL is not a programming language like Python or Java. It is a query language designed specifically for databases. :::
Why should you learn SQL?
SQL is required in almost every tech role (Developer, Analyst, Data Engineer)
It is easy to read and write compared to other languages
It works with almost all databases (MySQL, PostgreSQL, Oracle, SQL Server)
::: If you know SQL well, learning any database tool becomes much easier. :::
Your First SQL Query
Let’s start with the most basic SQL query.
SELECT * FROM employees;
This query means:
SELECT → choose data
  • → all columns
FROM employees → from the employees table
::: This type of query is used when you want to view all employee records from a company database. :::
Understanding SQL Tables
A table looks like this:
Rows → Records (each employee)
Columns → Fields (id, name, salary, department)
Example structure:
CREATE TABLE employees ( emp_id INT, emp_name VARCHAR(50), department VARCHAR(50), salary INT );
sql
SELECT u.name, SUM(o.amount) as total
FROM users u
JOIN orders o ON u.id = o.user_id
GROUP BY u.name;
::: Tables are the core building blocks of any relational database. :::
Common Beginner Mistakes
Forgetting semicolon (;) at the end of a query
Misspelling SQL keywords
Confusing table names and column names
::: SQL keywords are not case-sensitive, but table and column names may depend on the database. :::
Best Practices While Learning SQL
Write queries daily
Always visualize data as tables
Practice with real sample data
Understand the logic before memorizing syntax
::: You now understand what SQL is and how it is used. :::
Exercise (Your Turn 💻)
Try this:
Write a query to select only emp_name and salary from the employees table
Modify the table name and column names and see what errors you get
SELECT emp_name, salary FROM employees;
::: Do not move to the next lesson without practicing queries on a real database. :::