Create table in MySQL



Create Table in MySQL

In previous php tutorial we learn how to create new database in mysql, now in this php tutorial we will learn how to create new table in database.

CREATE TABLE Statement

The CREATE TABLE statement is used to create a table in MySQL.

Syntax

CREATE TABLE TableName
{

Column1 datatype,
Column2 datatype,
Column3 datatype

}

Now we take an example to understand how to create new table in MySQL.

Here, we create new table “StudentMst” with columns ID, Name, Address and City. The Create Table Syntax is :

CREATE TABLE StudemtMst
{

ID INT(6)  PRIMARY KEY,
Name VARCHAR(50)  NOT NULL,
Address VARCHAR(50)  NOT NULL,
City VARCHAR(50)  NOT NULL

}

Leave a Reply

Your email address will not be published. Required fields are marked *