Mysql建表SQL语句,几乎所有字段属性都有,可收藏备用

CREATE TABLE `chalide_demo` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(50) NOT NULL DEFAULT '',
  `description` TEXT,
  `created_at` DATE,
  `is_active` TINYINT(1) NOT NULL DEFAULT 0,
  `quantity` SMALLINT(6) NOT NULL DEFAULT 0,
  `price` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
  `discount` FLOAT(4,2),
  `rating` DOUBLE(4,2),
  `is_verified` BOOLEAN NOT NULL DEFAULT 0,
  `serial_number` SERIAL,
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `start_time` TIME,
  `year` YEAR,
  `gender` CHAR(1) NOT NULL DEFAULT '',
  `address` VARCHAR(100),
  `short_description` TINYTEXT,
  `long_description` MEDIUMTEXT,
  `extra_info` LONGTEXT,
  `binary_data` BINARY(50),
  `varbinary_data` VARBINARY(100),
  `tiny_blob` TINYBLOB,
  `medium_blob` MEDIUMBLOB,
  `blob_data` BLOB,
  `long_blob` LONGBLOB,
  `status` ENUM('active', 'inactive', 'pending') NOT NULL DEFAULT 'pending',
  `options` SET('option1', 'option2', 'option3') NOT NULL DEFAULT '',
  `location` GEOMETRY,
  `point` POINT,
  `line` LINESTRING,
  `polygon` POLYGON,
  `multi_point` MULTIPOINT,
  `multi_line` MULTILINESTRING,
  `multi_polygon` MULTIPOLYGON,
  `geometry_collection` GEOMETRYCOLLECTION,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

对应字段介绍可见: http://t.csdn.cn/bOrRw 

猜你喜欢

转载自blog.csdn.net/YUJIANYUE/article/details/130692514