What are the advantages and disadvantages of storing all information in the user table in a PHP application?

Storing all information in the user table in a PHP application can lead to a cluttered database with redundant data, making it harder to maintain and scale. It is recommended to normalize the database by creating separate tables for related data to improve efficiency and organization.

// Example of creating a separate table for user information and linking it to the user table with a foreign key

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

// Create user_info table
CREATE TABLE user_info (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT,
    full_name VARCHAR(100) NOT NULL,
    age INT,
    FOREIGN KEY (user_id) REFERENCES users(id)
);