Create Table in MySQL

By

Published August 12, 2014 at 3:21 PM

Creating a table in MySQL is pretty straight forward. I'll pretend like I'm making a users table.

CREATE TABLE `usersTBL` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`referenceID` INT(11) DEFAULT NULL,
`first_name` VARCHAR(32) DEFAULT NULL,
`last_name` VARCHAR(64) DEFAULT NULL,
`street_address` VARCHAR(128) DEFAULT NULL,
`DOB` varchar(DATE) DEFAULT NULL,
`date_joined` (DATETIME) DEFAULT NULL,
`about` (LONGTEXT) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `ID` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

These are pretty common basic fields to use. Pretty self explanatory.