Here are basics of Create Table statement in MySQL to get started and have a hands on experience.
1. Create Table :
MyFirstTable is the table name
column1 is 1st column that accepts only integer values and cannot be null.
column2 is 2nd column that accepts only Varchar i.e. String values and cannot be null.
column3 is 3rd column that accepts only integer values and cannot be null.
column4 is 3rd column that accepts only character values upto maximum of 25.
column1 also acts as a primary key i.e unique row identifier. No two rows can ever have the same value in column1 .
1. Create Table :
CREATE TABLE MyFirstTable(Explanation:
column1 INT NOT NULL,
column2 VARCHAR (20) NOT NULL,
column3 INT NOT NULL,
column4 CHAR (25) ,
PRIMARY KEY (column1)
);
MyFirstTable is the table name
column1 is 1st column that accepts only integer values and cannot be null.
column2 is 2nd column that accepts only Varchar i.e. String values and cannot be null.
column3 is 3rd column that accepts only integer values and cannot be null.
column4 is 3rd column that accepts only character values upto maximum of 25.
column1 also acts as a primary key i.e unique row identifier. No two rows can ever have the same value in column1 .
Basics of Create Table statement in MySQL
Reviewed by Ishan Dev Shukl
on
June 26, 2017
Rating:
No comments:
Thanks a lot for your valuable Comment!