9.9 CREATE TABLE Syntax

  建立資料表。如以下範例:
-- CREATE TABLE Syntax
CREATE TABLE IF NOT EXISTS `table1` (
    `column1` INT(11) NOT NULL AUTO_INCREMENT,
    `column2` INT(11) NOT NULL,
    `column3` INT(11) DEFAULT '0',
    `column4` VARCHAR(255) NOT NULL,
    `column5` TEXT NOT NULL,
    `column6` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
        ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`column1`),
    UNIQUE (`column2`),
    INDEX (`column3`),
    CONSTRAINT `foreign_key_name` FOREIGN KEY (`column3`)
        REFERENCES `table2` (`primary_key`)
        ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4
    COLLATE = utf8mb4_general_ci;