What are the best practices for naming table columns and foreign keys in MySQL databases for PHP applications?

When naming table columns and foreign keys in MySQL databases for PHP applications, it is important to use descriptive names that accurately reflect the data they represent. This can help improve the readability and maintainability of the database structure. Additionally, it is recommended to use consistent naming conventions, such as using lowercase letters and underscores to separate words. When defining foreign keys, it is advisable to use the same name as the primary key column in the referenced table to establish a clear relationship between the tables.

CREATE TABLE users (
    user_id INT PRIMARY KEY,
    username VARCHAR(50),
    email VARCHAR(100)
);

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