--删除表格
drop table detailes_table cascade constraints;
drop table province_table cascade constraints;
drop table user_table cascade constraints;
drop table country_table cascade constraints;
--删除序列
drop sequence user1;
drop sequence deta1;
drop sequence coun1;
drop sequence prov1;
--创建用户序列
create sequence user1
start with 1
increment by 1;
--创建用户表
create table user_table(
id number(6),
name varchar(25),
password varchar(16),
constraint user_table_id_pk primary key(id)
);
--创建国家序列
create sequence coun1
start with 1
increment by 1;
--创建国家表
create table country_table(
id number(6),
name varchar(25),
constraint country_table_id_pk primary key(id)
);
--创建省份序列
create sequence prov1
start with 1
increment by 1;
--创建省份表
create table province_table(
id number(6),
name varchar(25),
country_id number(6),
constraint province_table_id_pk primary key(id),
constraint province_table_country_id_fk foreign key (country_id) references country_table(id)
);
--创建用户详情序列
create sequence deta1
start with 1
increment by 1;
--创建用户详情表格
create table detailes_table(
id number(6),
name varchar(25),
country_id number(6),
province_id number(6),
constraint detailes_table_id_pk primary key(id),
constraint detailes_table_country_id_fk foreign key(country_id) references country_table(id),
constraint detailes_table_province_id_fk foreign key(province_id) references province_table(id)
);
commit;
select * from detailes_table;
select * from user_table;
select * from country_table;
select * from province_table;