Tools & Guides

Databases and SQL for beginners: from spreadsheets to tables

When a spreadsheet stops being enough, what a relational database is, the five SQL commands you'll use most, and how to choose between SQLite, MySQL and PostgreSQL.

Sury Kashyap·9 min read·Oct 2, 2026

Spreadsheets are great until several people edit the same file, rows reach the hundreds of thousands, or the same customer appears in five places with five spellings. That's when a database helps.

What is a relational database?

A relational database stores data in tables (like sheets) with fixed columns. Each row has a unique primary key, and tables link to each other through keys instead of copying data. For example, an orders table stores a customer_id rather than the customer's full details.

Five SQL commands you'll use most

-- 1. Read data
SELECT name, city FROM customers WHERE city = 'Hyderabad';

-- 2. Summarise
SELECT city, COUNT(*) AS customers FROM customers GROUP BY city;

-- 3. Combine tables
SELECT c.name, o.amount
FROM orders o JOIN customers c ON o.customer_id = c.customer_id;

-- 4. Add data
INSERT INTO customers (name, city) VALUES ('Asha Rao', 'Pune');

-- 5. Change data (always with a WHERE!)
UPDATE customers SET city = 'Mumbai' WHERE customer_id = 42;

Which database should you start with?

DatabaseBest for
SQLiteLearning, small apps and local analysis. It is a single file with no server needed, and it is built into Python.
MySQL / MariaDBWebsites and web apps. Usually available on shared hosting (including cPanel hosts).
PostgreSQLFeature-rich, reliable choice for growing business applications and analytics.

Good habits

  • Back up regularly and test that backups restore.
  • Give each person or app only the access it needs.
  • Never build SQL by pasting user input into strings. Use parameters to prevent SQL injection.
AI shortcut: "My table orders has columns order_id, customer_id, order_date, amount. Write a SQL query for total sales per month in 2026, and explain it line by line."

Further reading

46
LinkedIn X WhatsApp
3.7K25
SK

Sury Kashyap

Sury Kashyap is an independent consultant and certified corporate trainer with over 30 years in the Indian IT industry, focused on AI, communication, marketing and digital technologies with Python.

More about Sury →

Join the discussion

Have a question or a tip to add? Comments are reviewed before they're published.