首页 > 代码库 > 水电费管理系统需求分析----表格的建立( 电费表和价格表有待完善......)
水电费管理系统需求分析----表格的建立( 电费表和价格表有待完善......)
--建立用户信息表create table users( users_id varchar2(12) not null, users_name varchar2(12) not null, users_username varchar2(6) not null, users_userpassword varchar2(6) not null, users_phone number(11) not null, users_address varchar2(60) not null )--添加注释comment on column users.users_id is ‘用户编号(主键)‘;comment on column users.users_name is ‘用户姓名‘;comment on column users.users_username is ‘用户账户登录名‘;comment on column users.users_userpassword is ‘用户账户登录密码‘;comment on column users.users_phone is ‘用户联系方式‘;comment on column users.users_address is ‘用户住址‘; --添加主键约束alter table users add constraint PK_users primary key (users_id) --给登录名添加唯一约束alter table users add constraint UK_users unique (users_username);--添加三个信息insert into users values(‘001‘,‘张三‘,‘zhangs‘,‘666666‘,‘18865472008‘,‘阳光小区15号楼1单元102‘);insert into users values(‘002‘,‘李四‘,‘lisi01‘,‘666666‘,‘18865472009‘,‘阳光小区14号楼1单元301‘);insert into users values(‘003‘,‘王五‘,‘wangwu‘,‘666666‘,‘18865472010‘,‘阳光小区8号楼1单元402‘);--查看一下新建的users表select * from users
--建立水费缴纳情况信息表create table water( users_id varchar2(12) not null, water_sfjf varchar2(3) not null, water_time date, water_count number(9,2) not null, water_price number(9,2) not null, water_money number(9,2) not null, water_before number(9,2) not null )--添加注释comment on column water.users_id is ‘用户编号(外键)‘;comment on column water.water_sfjf is ‘上月是否缴纳水费‘;comment on column water.water_time is ‘缴费时间‘;comment on column water.water_count is ‘用水量(吨)‘;comment on column water.water_price is ‘单价‘;comment on column water.water_money is ‘本次应缴金额‘;comment on column water.water_before is ‘截止上月共缴水费‘; --添加外键alter table WATER add constraint FK_WATER foreign key (USERS_ID);--添加几个水费缴纳情况的信息信息insert into water values(‘001‘,‘是‘,sysdate,‘12.3‘,‘0.5‘,‘6.15‘,‘275.5‘);insert into water values(‘002‘,‘是‘,sysdate,‘16‘,‘0.5‘,‘8‘,‘395.7‘);insert into water values(‘003‘,‘否‘,‘‘,‘6‘,‘0.5‘,‘3‘,‘78.6‘);--查看一下新建的admin表select * from water
水电费管理系统需求分析----表格的建立( 电费表和价格表有待完善......)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。