What are the considerations for designing a database schema in PHP to efficiently store and retrieve data for multiple users or entities?

When designing a database schema in PHP to efficiently store and retrieve data for multiple users or entities, it is important to consider normalization to reduce redundancy, use indexes to optimize search queries, and establish relationships between tables to maintain data integrity. Additionally, utilizing proper data types and constraints can help ensure data accuracy and consistency.

CREATE TABLE users (
    id INT PRIMARY KEY,
    username VARCHAR(50) NOT NULL,
    email VARCHAR(100) NOT NULL,
    password VARCHAR(255) NOT NULL
);

CREATE TABLE posts (
    id INT PRIMARY KEY,
    user_id INT,
    title VARCHAR(100) NOT NULL,
    content TEXT,
    created_at TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id)
);