What best practices should be followed when structuring database tables for PHP applications to avoid data redundancy?

To avoid data redundancy in database tables for PHP applications, it is important to normalize the database structure. This involves breaking down data into separate tables and establishing relationships between them using foreign keys. By organizing data in this way, it reduces the chances of duplicate data and ensures data integrity.

CREATE TABLE users (
    id INT PRIMARY KEY,
    username VARCHAR(50) UNIQUE
);

CREATE TABLE orders (
    id INT PRIMARY KEY,
    user_id INT,
    order_date DATE,
    FOREIGN KEY (user_id) REFERENCES users(id)
);