MySQL: CREATE TABLE Statement

Profile picture for user arilio666

To create a table in MySQL we will be using the CREATE statement where will create a table inside the respective database. The Table should be created with the respective data types along with the column names which you are gonna use as per your wish. The datatypes can be varchar,bigint,char,date,int etc.

Syntax

CREATE table TableName(
columnname datatype,
columnname2 datatype
)

Let us create a table with details of employees.

Example

create table Emp_details(EID int,
First_name varchar(50),
Last_name varchar(50),
Sex char,
Salary varchar(40))

So we are clear now on how to create a table with various columns and match data types to each.

Tags