• Have Any Question?
  • contact@eitworld.com

MySQLi Create Table

Create Table In MySQL by using the create command of MySQL. You have to define the table name and field name with data type and size to create the table.

How to Create Tables in MySQL:

the following syntax is used to Create Table in MySQL:

Create table table_name(field1 (size), field2(size), fieldN(size));


Create Table in MySQL

Create table user (user_idint(10), user_namevarchar(20));

You can learn Create Table in MySQL from eitworld.com in easy way with explained examples.

  • After creating a database, tables are to be created to insert the data.

Creating Table

  • To create a table in MySQL, use CREATE TABLE statement.


CREATE TABLE tablename(columnName1 datatype,columnName2 datatype,…)
  • Some of the datatypes that MySQL use are-
    • integer- For integer type data. (1, -50, 50, 846 etc.)
    • real- For real type data. (2.35, 4e3 etc.)
    • text- For plain text.
    • char[number]- For fixed number of characters. (char[50])
    • varchar[number]- For variable number of characters. (varchar[50])
  • This statement must be added to php function mysqli_query(), which is used to execute all the queries in MySQL. Queries are discussed in the chapter Introduction to MySQL.
  • Before creating a table, a database must be connected. We are connecting the database firstdb and we will create the table inside it.

<!DOCTYPE html>


$table=”CREATE TABLE employee(

id integer,

name char(50),

salary integer,

contact text






Real Time Web Analytics