What best practices should be followed when designing database tables to avoid unnecessary data redundancy and improve efficiency in PHP applications?

To avoid unnecessary data redundancy and improve efficiency in PHP applications, it is important to follow best practices when designing database tables. This includes normalizing the database structure to eliminate redundant data, using appropriate data types and indexes, and avoiding storing large amounts of unnecessary data in a single table.

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 NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id)
);