In what situations would creating additional tables be a recommended practice in PHP database design?

Creating additional tables in PHP database design is recommended when you need to organize data into separate entities to avoid redundancy, improve data integrity, and optimize query performance. For example, if you have a database for an e-commerce website, you might create separate tables for products, orders, and customers to better structure and manage the data.

CREATE TABLE products (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50) NOT NULL,
    price DECIMAL(10, 2) NOT NULL
);

CREATE TABLE orders (
    id INT AUTO_INCREMENT PRIMARY KEY,
    product_id INT,
    customer_id INT,
    quantity INT,
    FOREIGN KEY (product_id) REFERENCES products(id),
    FOREIGN KEY (customer_id) REFERENCES customers(id)
);

CREATE TABLE customers (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50) NOT NULL,
    email VARCHAR(50) NOT NULL
);