What is SQL?

SQL FoundationsIntroductionFree Lesson

Advertisement

What is SQL?

SQL (Structured Query Language) is the standard language for managing and querying relational databases. It was originally developed at IBM in the 1970s by Donald Chamberlin and Raymond Boyce.

šŸ’” SQL is declarative — you describe WHAT data you want, not HOW to retrieve it. The database engine figures out the optimal execution plan.

Why SQL Matters

BenefitDescription
UniversalUsed by every major database: MySQL, PostgreSQL, SQL Server, Oracle, SQLite
PowerfulCan handle billions of rows efficiently
DeclarativeFocus on results, not implementation details
StandardizedANSI/ISO standard since 1986
Career EssentialRequired skill for data analysts, engineers, scientists

How Databases Work

A relational database organizes data into tables (also called relations). Each table has:

  • Columns (attributes) — what fields exist
  • Rows (records) — individual data entries
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│              customers                   │
ā”œā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ id │ name     │ city    │ email         │
ā”œā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ 1  │ Alice    │ NYC     │ a@mail.com    │
│ 2  │ Bob      │ LA      │ b@mail.com    │
│ 3  │ Charlie  │ Chicago │ c@mail.com    │
ā””ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Types of SQL Commands

CategoryFull NamePurposeExample Commands
DDLData Definition LanguageDefine database structureCREATE, ALTER, DROP, TRUNCATE
DMLData Manipulation LanguageQuery and modify dataSELECT, INSERT, UPDATE, DELETE
DCLData Control LanguageControl access permissionsGRANT, REVOKE
TCLTransaction Control LanguageManage transactionsCOMMIT, ROLLBACK, SAVEPOINT

Your First Query

-- Select all columns from the customers table
SELECT * FROM customers;

-- Select specific columns
SELECT name, email FROM customers;

-- Filter results
SELECT name, city
FROM customers
WHERE city = 'NYC';

Result:

namecity
AliceNYC

SQL vs NoSQL

FeatureSQL (Relational)NoSQL (Non-relational)
StructureFixed schemaFlexible schema
Data ModelTables with rows/columnsDocuments, key-value, graphs
RelationshipsStrong (JOINs)Weak or none
ACID ComplianceYesOften eventual consistency
Best ForStructured data, complex queriesUnstructured data, scaling

āš ļø SQL databases are not "old technology." They remain the backbone of most enterprise systems and are continuously evolving with new features.

Real-World Applications

  • E-commerce: Product catalogs, orders, customer management
  • Finance: Transaction processing, fraud detection, reporting
  • Healthcare: Patient records, medical billing, research data
  • Social Media: User profiles, posts, connections
  • Analytics: Business intelligence, dashboards, forecasting

āœļø Exercise: Write a SQL query to select all columns from a table called 'products'.

See Solution

SELECT * FROM products;

āœ… Key Takeaways

  1. SQL is the universal language for relational databases
  2. SQL is declarative — you describe what you want, not how to get it
  3. DDL defines structure, DML manipulates data, DCL controls access, TCL manages transactions
  4. SQL databases use tables with columns (attributes) and rows (records)
  5. SQL remains the most widely-used data language in the world

Advertisement

Need Expert SQL Help?

Get personalized SQL training or database consulting.

Advertisement