2、设计数据库系统E-R图,通常包括以下实体:员工实体、员工工资实体、工资等级实体、部分岗位实体、工龄实体、公司福利实体;
3、根据E-R图列出需要的数据库数据表;
4、通过SQL SREVER 数据库软件建议相应的数据表
/*按照你的要求,比如:6个大类:A,B,C,D,E,FB类下面有小类B1,B2,单价分别为3,4
C类下面有小类C1,C2,单价分别为5,6
D类下面有小类D1,D2,单价分别为7,8
E类下面有小类E1,E2,单价分别为9,10
F类下面有小类F1,F2,单价分别为11,12
*/
--设计一个基础配置表:
create table a(
id varchar2(20),
superid varchar2(20),
discription varchar2(20),
money number(10))
-- 插入数据
insert into a(id,superid,discription,money)VALUES('A1','A','小类A1',1)
insert into a(id,superid,discription,money)VALUES('A2','A','小类A2',2)
insert into a(id,superid,discription,money)VALUES('B1','B','小类B1',3)
insert into a(id,superid,discription,money)VALUES('B2','B','小类B2',4)
insert into a(id,superid,discription,money)VALUES('C1','C','小类C1',5)
insert into a(id,superid,discription,money)VALUES('C2','C','小类C2',6)
insert into a(id,superid,discription,money)VALUES('D1','D','小类D1',7)
insert into a(id,superid,discription,money)VALUES('D2','D','小类D2',8)
insert into a(id,superid,discription,money)VALUES('E1','E','小类E1',9)
insert into a(id,superid,discription,money)VALUES('E2','E','小类E2',10)
insert into a(id,superid,discription,money)VALUES('F1','F','小类F1',11)
insert into a(id,superid,discription,money)VALUES('F2','F','小类F2',12)
-- 例如:输入工序名"小类C1"查找其单价的sql语句:
SELECT money FROM a WHERE a.discription = '小类C1'
-- 例如:输入工序名"小类C1"的数量为"100",可以直接计算出工资的sql语句:
SELECT money*100 FROM a WHERE a.discription = '小类C1'
-- 希望对你有帮助
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)