Introduction to SQL
SQL is the language of relational databases — the most widely deployed data storage technology in the world. Every South African bank, insurer, retailer, and government department uses it.
What is SQL?
SQL (Structured Query Language) is an ISO-standard language for creating, querying, and managing data in relational databases. It was developed at IBM in the 1970s, standardised in 1986, and remains the dominant language for structured data management.
SQL is not a programming language in the traditional sense — it is declarative. You describe what data you want, not how to retrieve it. The database engine decides the most efficient way to execute your query.
Why SQL Matters in South Africa
Almost every business system in South Africa that stores structured data — banking transactions, patient records, retail inventory, government population registers, insurance claims — uses a relational database. SQL is the skill that connects application code to data. A Java developer who cannot write SQL cannot build a complete system. A data analyst who cannot write SQL cannot answer business questions from data. SQL is not optional in professional ICT.
SQL Sub-Languages
SQL is divided into sub-languages by what they do:
| Sub-language | Purpose | Key statements |
|---|---|---|
| DQL — Data Query Language | Retrieve data | SELECT |
| DDL — Data Definition Language | Define structure | CREATE, ALTER, DROP |
| DML — Data Manipulation Language | Change data | INSERT, UPDATE, DELETE |
| DCL — Data Control Language | Manage permissions | GRANT, REVOKE |
| TCL — Transaction Control Language | Manage transactions | COMMIT, ROLLBACK, SAVEPOINT |
Common Database Engines
- MySQL — open source, widely used in web applications.
- PostgreSQL — powerful open source, preferred in data engineering and new enterprise projects.
- SQL Server — Microsoft's enterprise database, dominant in South African banking, insurance, and government.
- SQLite — embedded, file-based, zero configuration. Perfect for learning and mobile apps.
- Oracle — enterprise legacy, found in large banks and telcos.
SQL is largely portable between these — about 80% of your SQL will work the same everywhere. The remaining 20% are vendor-specific syntax differences (date functions, string functions, pagination). We note differences throughout this course.
-- Your first SQL query:
SELECT * FROM learners;
-- A more specific query:
SELECT full_name, course, mark
FROM learners
WHERE mark >= 50
ORDER BY mark DESC;
-- SQL keywords are NOT case-sensitive:
-- select * from learners -- works but unprofessional
-- SELECT * FROM learners -- professional standard
Practice Task
Your Turn
Install SQLite (bundled with Python: python -c "import sqlite3; print(sqlite3.version)") or DB Browser for SQLite (sqlitebrowser.org). Create a new database, open the SQL tab, and run: SELECT 'Hello, Your IT Tutor!' AS greeting; Confirm you see the output. Note which database engine you are using throughout this course.
Common Mistakes
- SQL keywords (SELECT, FROM, WHERE) are not case-sensitive, but writing them in uppercase is professional convention.
- SQL is a language; MySQL and SQL Server are engines that run it — different software.
- Syntax varies between engines — what works in MySQL may need adjustment in SQL Server.
- Semicolons at the end of statements — required by some tools and engines, good practice everywhere.
Professional Tip
SQL is one of the most durable skills in technology. The core of SQL has not changed fundamentally since 1986. Learning it is an investment that does not depreciate.
Mini Quiz
What does SQL stand for?