Creating ENUM variable type in MySQL

后端 未结 2 630
抹茶落季
抹茶落季 2020-12-05 18:02

I am using an ENUM data type in MySQL and would like to reuse it, but not retype in the values. Is there an equivalent to the C, C++ way of defining types in MySQL?

2条回答
  •  青春惊慌失措
    2020-12-05 18:30

    Example given below for mysql db.

    CREATE TABLE `data` (
    `Id` int(11) NOT NULL AUTO_INCREMENT,
      `gender` enum('Male','Female') DEFAULT NULL,
    PRIMARY KEY (`Id`)
      ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_0900_ai_ci
    

提交回复
热议问题