Database Tutorials

SQL Basics

Learn the fundamentals of Structured Query Language (SQL), the most widely used language for relational databases.

SELECT Statement

Retrieve data from one or more tables.

SELECT column1, column2
FROM   users
WHERE  age > 18
ORDER BY created_at DESC;

INSERT Statement

INSERT INTO users (name, email, age)
VALUES ('Jane Doe', 'jane@example.com', 28);

NoSQL Overview

NoSQL databases provide flexible schemas and horizontal scaling. Here are three popular types.

Document Stores (MongoDB)

db.users.insertOne({
  name: "John Smith",
  email: "john@example.com",
  tags: ["admin", "beta"]
});

Key‑Value Stores (Redis)

SET session:12345 "user_id=7"

Column Family (Cassandra)

INSERT INTO users (id, name, email)
VALUES (uuid(), 'Alice', 'alice@example.com');

Object‑Relational Mapping (ORM)

ORMs let you interact with databases using native language objects.

Example with Sequelize (Node.js)

const { Model, DataTypes } = require('sequelize');
class User extends Model {}
User.init({
  name: DataTypes.STRING,
  email: DataTypes.STRING
}, { sequelize, modelName: 'user' });

await User.create({ name: 'Bob', email: 'bob@example.com' });

Performance Tips

Further Learning