1. Home
  2. SQL
  3. MySQL Tutorial
  4. MySQL – Create Table

MySQL – Create Table

Use CREATE TABLE statement to create a new table in MySQL database. You must create and select a database to create tables in it.

Syntax:

CREATE TABLE [IF NOT EXISTS] table_name (
     coloumn1,
     coloumn2
  ) engine=table_type;

Here [IF NOT EXISTS] is used to create table only if there are no existing table with the name. The database engine can be used as per your requirements. A column can be defined as following.

 column_name data_type[size] [NOT NULL|NULL] [DEFAULT value] [AUTO_INCREMENT],

Example:

For example, create table users to store information of our web application users with there account login information.

Tags , ,