水电缴费管理系统数据表设计
SQL建表脚本:
--建表
--管理人员表 admin
create table admin(
admin_id varchar2(3) not null,
admin_loginname varchar2(8) not null,
admin_password varchar2(6) not null,
admin_username varchar2(4) not null,
constraint pk_admin primary key(admin_id)
);
comment on column admin.admin_id is ‘管理员编号‘;
comment on column admin.admin_loginname is ‘管理员登录用户名‘;
comment on column admin.admin_password is ‘管理员登录密码‘;
comment on column admin.admin_username is ‘管理员姓名‘;
--用户基本信息表 user
create table users(
user_id varchar2(10) not null,
user_loginname varchar2(8) not null,
user_password varchar2(6) not null,
user_username varchar2(4) not null,
user_address varchar2(20) not null,
user_phone number(11) not null,
constraint pk_users primary key(user_id)
);
comment on column users.user_id is ‘用户编号‘;
comment on column users.user_loginname is ‘用户登录名‘;
comment on column users.user_password is ‘用户登录密码‘;
comment on column users.user_username is ‘用户姓名‘;
comment on column users.user_address is ‘用户地址‘;
comment on column users.user_phone is ‘用户电话‘;
--水表 water
create table water(
water_id varchar2(10) not null,
userid varchar2(10) not null,
water_count number(3,2) not null,
water_time date not null,
water_status number(1) not null,
water_priceid varchar2(10) not null,
water_beforecount number(3,2) not null,
constraint pk_water primary key(water_id)
);
comment on column water.water_id is ‘水表编号‘;
comment on column water.userid is ‘用户编号‘;
comment on column water.water_count is ‘水表跑数‘;
comment on column water.water_time is ‘水表时间‘;
comment on column water.water_status is ‘水费缴费状态‘;
comment on column water.water_priceid is ‘水费价格编号‘;
comment on column water.water_beforecount is ‘上月水表跑数‘;
--水表 power
create table power(
power_id varchar2(10) not null,
userid varchar2(10) not null,
power_count number(3,2) not null,
power_time date not null,
power_status number(1) not null,
power_priceid varchar2(10) not null,
power_beforecount number(3,2) not null,
constraint pk_power primary key(power_id)
);
comment on column power.power_id is ‘电表编号‘;
comment on column water.userid is ‘用户编号‘;
comment on column power.power_count is ‘电表跑数‘;
comment on column power.power_time is ‘电表时间‘;
comment on column power.power_status is ‘电费缴费状态‘;
comment on column power.power_priceid is ‘电费价格编号‘;
comment on column power.power_beforecount is ‘上月电表跑数‘;
--价格表 money
create table price(
price_id varchar2(10) not null,
price_time date not null,
isactive number(1) not null,
waterprice number(2,2) not null,
powerprice number(2,2) not null,
constraint pk_price primary key(price_id)
);
comment on column price.price_id is ‘价格编号‘;
comment on column price.price_time is ‘价格日期‘;
comment on column price.isactive is ‘价格状态‘;
comment on column price.waterprice is ‘水费价格‘;
comment on column price.powerprice is ‘电费价格‘;
管理员表:
水费表:
电费表:
价格表: