MySql "CREATE TABLE" query syntax with example

In this article we will see "How to CREATE a Table in MySql" and "MySql CREATE TABLE query syntax with example".

"CREATE TABLE" query syntax

"CREATE TABLE" is used to CREATE a Table in MySql, the syntax is as follow.

CREATE TABLE table_name (
    column1 datatype,
    column2 datatype,
    column3 datatype,

"CREATE TABLE" query example

"CREATE TABLE" is used to CREATE a Table in MySql, as shown in the example below.

/* Use database where the table is going to be created*/
use testDatabase;

/* Create table */
CREATE TABLE testTable (
    id int,
    name varchar(30),
    email varchar(20)

Output: Output will be something like this:

Query OK, 0 rows affected (0.11 sec)

In this article we have seen "How to CREATE a Table in MySql", in upcoming articles we will see more about Mysql syntax and queries with example.

About The Author

Nagesh Chauhan

Nagesh Chauhan has 8+ years of software design and development experience in variety of technologies like - Core Java, Java 8 (Streams, Lambda), J2EE (Servlet, JSP), Spring Framework (MVC, IOC, JDBC, SECURITY etc), Spring Boot and Microservices, Kafla, Redis, Cassandra and Spark.