Create table syntax.

If you facing difficulty to create new table then this tutorial will help you. Here I am creating a table with primary key and auto incremented value and also creating a index on second column name.

Create table syntex is as follows.
CREATE TABLE `tableName` (
  `column1` int(11) NOT NULL AUTO_INCREMENT,
  `column2` varchar(200) DEFAULT NULL,
  `column3` int(11) NOT NULL,
  .
  .
  .
  `column-n` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`column1`),
  KEY `column2` (`column2`)
) ENGINE=EngineName AUTO_INCREMENT=1 DEFAULT CHARSET=Charset

Where
1. EngineName- innoDB, MyISAM etc
2. AUTO_INCREMENT- 0
3. CHARSET- utf8, latin1

Note: Using latin1 as a default character may store special character and you may not be able to read that data. MySQL is now not supporting latin1 character set.

 

Posted in MySQL | Tagged , | Comments Off

Comments are closed.