Batch 3: SQL Databases LDAP ← Full TOC
Ch.34 YAML Ch.35 SQL Ch.36 LDAP ← Full TOC

🗄️ Chapter 35 — SQL

Complete Reference with Copy-Paste Examples
Part of The Direct Path to Linux Ubuntu — free for all students and developers.

6Topics
5Examples
sqlite3Run
SQL:2023Version
FreeNo login
📄 Open SQL Reference 🏠 SQL Index
📜 Topics Covered
📋 Core SQLSELECT, INSERT, UPDATE, DELETE, JOINs, subqueries…
🏗️ DDL & SchemaCREATE, ALTER, DROP, indexes, constraints, data types…
📊 AggregatesCOUNT, SUM, AVG, GROUP BY, window functions, RANK…
🗄️ MySQL & PGJSONB, UPSERT, EXPLAIN, FULLTEXT, arrays…
⚡ TransactionsACID, BEGIN, COMMIT, ROLLBACK, isolation levels…
🐍 SQL in Pythonsqlite3, psycopg2, mysql-connector, SQLAlchemy…
🎓 Why Learn SQL?
🗄️

Relational Data Foundation

SQL is the language of every relational database — MySQL, PostgreSQL, SQLite, Oracle, SQL Server. One language, every platform.

📊

Data Analysis Power

Window functions, CTEs, GROUP BY with HAVING — SQL processes millions of rows in milliseconds with a single declarative statement.

🔒

ACID Transactions

BEGIN/COMMIT/ROLLBACK ensure data integrity — bank transfers, inventory, anything where partial updates would cause corruption.

🐍

Python Integration

sqlite3 is built into Python. psycopg2 connects to PostgreSQL. SQLAlchemy provides ORM for any database — no SQL string juggling.

⚡ Quick Run Reference

Run SQL:

# SQLite (built-in, no install)
sqlite3 database.db             # interactive shell
sqlite3 database.db < schema.sql  # run SQL file
python3 script.py               # python3 sqlite3 built-in

# PostgreSQL
sudo apt install postgresql postgresql-client
sudo systemctl start postgresql
psql -U postgres                # interactive shell
psql -U user -d mydb -f file.sql

# MySQL/MariaDB
sudo apt install mysql-server
sudo systemctl start mysql
mysql -u root -p               # interactive shell
mysql -u user -p mydb < file.sql

# Python
pip install psycopg2-binary     # PostgreSQL
pip install mysql-connector-python  # MySQL
pip install sqlalchemy          # ORM for all databases
Prev Home Next