How do you create an empty database table in MySQL?

To create an empty database table, you can use the following MySQL statement:

CREATE TABLE table_name (
    column1 datatype,
    column2 datatype,
    column3 datatype,
    ...
);

You will need to specify the name of the table you want to create as “table_name”, and then list the column names such as column1, column2, column3, etc., along with their respective data types as “datatype”.

Here is an example:

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50),
    email VARCHAR(100),
    age INT
);

This example creates a table called “users” with four columns: id, name, email, and age.

Please note, the “id” column in the above example is using INT AUTO_INCREMENT PRIMARY KEY, which means this column is an auto-incrementing integer and serves as the primary key for the table.

bannerAds