37 lines
1.7 KiB
SQL
37 lines
1.7 KiB
SQL
-- 描述一个人的身份证号和其他个人信息
|
|
create table sku.person
|
|
(
|
|
id bigserial not null
|
|
constraint person_pk primary key,
|
|
address1 smallint not null,
|
|
address2 smallint not null,
|
|
address3 smallint not null,
|
|
birthday date not null,
|
|
sequence_number smallint not null,
|
|
gender_coder smallint not null,
|
|
check_code smallint not null,
|
|
gender boolean not null,
|
|
name varchar(30) not null,
|
|
name_initials varchar(30) not null,
|
|
address varchar(150) not null default '',
|
|
phone_number varchar(25),
|
|
update_time timestamp not null
|
|
);
|
|
comment on table sku.person is 'person';
|
|
comment on column sku.person.address1 is 'address1';
|
|
comment on column sku.person.address2 is 'address2';
|
|
comment on column sku.person.address3 is 'address3';
|
|
comment on column sku.person.birthday is 'birthday';
|
|
comment on column sku.person.sequence_number is 'sequence number';
|
|
comment on column sku.person.gender_coder is 'gender coder';
|
|
comment on column sku.person.check_code is 'check code';
|
|
comment on column sku.person.gender is 'Biological sex';
|
|
comment on column sku.person.name is 'name';
|
|
comment on column sku.person.name_initials is 'name initials';
|
|
comment on column sku.person.address is 'full address text';
|
|
comment on column sku.person.phone_number is 'phone number';
|
|
create index person_birthday_index on sku.person (birthday);
|
|
create unique index person_id_code_index on sku.person (address1, address2, address3, birthday, sequence_number, gender_coder);
|
|
create index person_name_initials_index on sku.person (name_initials);
|
|
create index person_sex_index on sku.person (gender);
|