关于数据库:全数据库创建语句包含所有数据类型

4次阅读

共计 3887 个字符,预计需要花费 10 分钟才能阅读完成。

注:如果有雷同类型呈现屡次,则创立时为不同类型。创立语句以创立实现后显示 SQL 为准

Hive

-- auto-generated definition
create table table1
(
    column1  tinyint,
    column2  smallint,
    column3  bigint,
    column4  int,
    column5  float,
    column6  double,
    column7  decimal(8, 2),
    column8  timestamp,
    column9  date,
    column10 string,
    column11 varchar(100),
    column12 char(100),
    column13 boolean,
    column14 binary,
    column15 array<string>,
    column16 struct<a:int,b:string>,
    column17 uniontype<int,string>
) row format serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' stored as inputformat 'org.apache.hadoop.mapred.TextInputFormat' outputformat 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' location 'hdfs://hadoop67:9000/opt/hive/warehouse/wzw.db/table1';

TiDB

create table `table1`
(`column1`  tinyint(8)     default null,
    `column2`  smallint(8)    default null,
    `column3`  mediumint(8)   default null,
    `column4`  int(8)         default null,
    `column5`  bigint(8)      default null,
    `column6`  float(8, 2)    default null,
    `column7`  double(8, 2)   default null,
    `column8`  decimal(8, 2)  default null,
    `column9`  date           default null,
    `column10` time           default null,
    `column11` year(4)        default null,
    `column12` datetime       default null,
    `column13` timestamp null default null,
    `column14` char(8)        default null,
    `column15` varchar(8)     default null,
    `column16` tinyblob       default null,
    `column17` tinytext       default null,
    `column18` tinyblob       default null,
    `column19` tinytext       default null,
    `column20` mediumblob     default null,
    `column21` mediumtext     default null,
    `column22` longblob       default null,
    `column23` longtext       default null
) engine = InnoDB
  default charset = utf8mb4
  collate = utf8mb4_bin

MariaDB

create table `table1`
(`column1`  tinyint(8)              default null,
    `column2`  tinyint(1)              default null,
    `column3`  smallint(8)             default null,
    `column4`  mediumint(8)            default null,
    `column5`  int(8)                  default null,
    `column6`  bigint(8)               default null,
    `column7`  decimal(8, 2)           default null,
    `column8`  float(8, 2)             default null,
    `column9`  double(8, 2)            default null,
    `column10` bit(8)                  default null,
    `column11` date                    default null,
    `column12` time                    default null,
    `column13` datetime                default null,
    `column14` timestamp null          default null,
    `column15` year(4)                 default null,
    `column16` char(8)                 default null,
    `column17` varchar(8)              default null,
    `column18` binary(8)               default null,
    `column19` varbinary(8)            default null,
    `column20` tinyblob                default null,
    `column21` tinyblob                default null,
    `column22` mediumblob              default null,
    `column23` longblob                default null,
    `column24` tinytext                default null,
    `column25` tinytext                default null,
    `column26` mediumtext              default null,
    `column27` longtext                default null,
    `column28` enum ('哺乳动物','非哺乳动物')   default null,
    `column29` set ('value1','value2') default null
) engine = InnoDB
  default charset = utf8

KunDB

create table `table1`
(
    `column1`  tinyint                        default null,
    `column2`  smallint                       default null,
    `column3`  mediumint                      default null,
    `column4`  int                            default null,
    `column5`  bigint                         default null,
    `column6`  float(8, 2)                    default null,
    `column7`  double(8, 2)                   default null,
    `column8`  decimal(8, 2)                  default null,
    `column9`  date                           default null,
    `column10` time                           default null,
    `column11` year                           default null,
    `column12` datetime                       default null,
    `column13` timestamp null                 default null,
    `column14` char(8) collate utf8mb4_bin    default null,
    `column15` varchar(8) collate utf8mb4_bin default null,
    `column16` tinyblob,
    `column17` tinytext collate utf8mb4_bin,
    `column18` tinyblob,
    `column19` tinytext collate utf8mb4_bin,
    `column20` mediumblob,
    `column21` mediumtext collate utf8mb4_bin,
    `column22` longblob,
    `column23` longtext collate utf8mb4_bin
) engine = InnoDB
  default charset = utf8mb4
  collate = utf8mb4_bin

PostgreSQL

-- DROP TABLE table1;

create table table1
(
    colum1  int2          null,
    colum2  int4          null,
    colum3  int8          null,
    colum4  numeric(8, 2) null,
    colum5  numeric(8, 2) null,
    colum6  float4        null,
    colum7  float8        null,
    colum8  smallserial   not null,
    colum9  serial        not null,
    colum10 bigserial     not null,
    colum11 money         null,
    colum12 varchar(8)    null,
    colum13 varchar(8)    null,
    colum14 bpchar(8)     null,
    colum15 bpchar(8)     null,
    colum16 text          null,
    colum17 timestamp(6)  null,
    colum18 date          null,
    colum19 time(6)       null,
    colum20 interval(6)   null,
    colum21 bool          null,
    colum22 point         null,
    colum23 line          null,
    colum24 lseg          null,
    colum25 box           null,
    colum26 path          null,
    colum27 polygon       null,
    colum28 circle        null,
    colum29 cidr          null,
    colum30 tsvector      null,
    colum31 json          null,
    colum32 xml           null,
    colum33 _int4         null,
    colum34 _text         null,
    colum35 _int4         null,
    colum36 uuid          null
);
正文完
 0