Notes – Introduction to SQL

Structured Query Language (SQL) is the standard language used to interact with relational databases. It helps us store, retrieve, manage, and manipulate data in a structured format.


What is SQL?

  • SQL stands for Structured Query Language
  • It is used to communicate with Relational Database Management Systems (RDBMS)
  • Examples of popular RDBMS: MySQL, PostgreSQL, Oracle, SQL Server

Why do we use SQL?

SQL helps you:

  • Create databases and tables
  • Insert, update, and delete data
  • Fetch specific data using queries
  • Apply conditions and filters to data
  • Set permissions and manage access
  • Perform analytics and reporting

Real-Life Analogy

Think of SQL as a language to ask questions to a data warehouse.

For example:
You walk into a library (database) and ask:
โ€œShow me all the books written by ‘Author A’ after 2015.โ€
That question is a SQL query.


Basic SQL Operations (CRUD)


OperationSQL CommandDescription
CreateINSERTAdd new data into a table
ReadSELECTRetrieve data from one or more tables
UpdateUPDATEModify existing data
DeleteDELETERemove data from a table

SQL is Declarative

  • SQL tells what to do, not how to do it
  • You define the result, and the system decides the best way to get it
  • Example: sqlCopyEditSELECT name FROM students WHERE grade > 80; Youโ€™re saying what you want โ€” not how to fetch it behind the scenes

What SQL is NOT

  • Itโ€™s not a programming language like Python or Java
  • It doesnโ€™t handle application logic or UI design
  • Itโ€™s focused only on managing data

Quick Example

Hereโ€™s a basic SQL query:

SELECT first_name, last_name 
FROM employees
WHERE department = 'HR';

This means: โ€œGet the first and last names of employees who work in the HR department.โ€