use 项目管理系统 create table personnel( pid char(5) primary key, name varchar(10) not null, sex varchar(5) check(sex='man' or sex='woman'), position varchar(10) not null, telephone varchar(20) not null, adress varchar(30) null ) create table department( did char(5) primary key, name varchar(10) not null, found_time datetime not null, person_amount int not null, telephone varchar(20) not null, fax varchar(20) null ) create table item( Iid char(5) primary key, name varchar(5) unique, worker_numbers int, start_time datetime not null, terminal_time datetime not null, bcws int not null, res text not null ) create table item_progress( Iid char(5) primary key, acwp int not null, bcwp int not null, cb numeric check(cb>-1 and cb<=0), cpi numeric check(cpi>=0 and cpi<1), sv int not null, spi numeric check(spi>=0 and spi<1), foreign key(Iid) references item(Iid) ) create table personnal_achievement( pid char(5), did char(5), Iid char(5), recieve_items int, complete_items int, salary int primary key(pid,did,Iid), foreign key(pid) references personnel(pid), foreign key(did) references department(did), foreign key(Iid) references item(Iid) ) alter table item_progress add bcws int not null
alter table item_progress add bcws int not null为什么要多此一举呢?创建的时候直接创建不就行了?
create table personnel(
pid char(5) primary key,
name varchar(10) not null,
sex varchar(5) check(sex='man' or sex='woman'),
position varchar(10) not null,
telephone varchar(20) not null,
adress varchar(30) null
)
create table department(
did char(5) primary key,
name varchar(10) not null,
found_time datetime not null,
person_amount int not null,
telephone varchar(20) not null,
fax varchar(20) null
)
create table item(
Iid char(5) primary key,
name varchar(5) unique,
worker_numbers int,
start_time datetime not null,
terminal_time datetime not null,
bcws int not null,
res text not null
)
create table item_progress(
Iid char(5) primary key,
acwp int not null,
bcwp int not null,
cb numeric check(cb>-1 and cb<=0),
cpi numeric check(cpi>=0 and cpi<1),
sv int not null,
spi numeric check(spi>=0 and spi<1),
foreign key(Iid)
references item(Iid)
)
create table personnal_achievement(
pid char(5),
did char(5),
Iid char(5),
recieve_items int,
complete_items int,
salary int
primary key(pid,did,Iid),
foreign key(pid)
references personnel(pid),
foreign key(did)
references department(did),
foreign key(Iid)
references item(Iid)
)
alter table item_progress
add bcws int not null
add bcws int not null为什么要多此一举呢?创建的时候直接创建不就行了?
http://topic.csdn.net/u/20081115/11/6e88ce4a-fd50-4c88-9d44-288ad8c3a2e4.html
http://topic.csdn.net/u/20081114/14/b83cc360-73f9-4834-aee9-a1040a9e41ac.html倒分也要倒出点水准来吧...