drop
table athlete;
create
table athlete (
ano char(10) not
null
primary
key,
aname char(20),
a*** char(5),
ateam char(16)
);insert
into athlete values('1001','金賢重','男','大連');
insert
into athlete values('1002','李敏鎬','男','大連');
insert
into athlete values('1003','金鍾國','女','瀋陽');
insert
into athlete values('1007','司馬','男','吉林');
insert
into athlete values('1004','李白','女','吉林');
insert
into athlete values('1005','馬忠','女','火星');
insert
into athlete values('1008','司馬遷','男','瀋陽');
drop
table item;
create
table item(
ino char(10) not
null
primary
key,
iname char(20),
itime char(5),
iplace char(20)
);insert
into item values('1000','跳水',1000,'1');
insert
into item values('1001','跳高',1005,'2');
insert
into item values('1002','游泳',1010,'3');
insert
into item values('1003','籃球',1020,'4');
drop
table games;
create
table games(
ano char(10),
ino char(10),
score int,
constraint ai_pk primary
key(ano ,ino),
constraint ai_fk1 foreign
key(ano) references athlete(ano),
constraint ai_fk2 foreign
key(ino) references item(ino),
constraint ai_score check (score between 0
and10
or score is
null)
);insert
into games values('1001','1000',1);
insert
into games values('1003','1001',3);
insert
into games values('1004','1001',4);
insert
into games values('1002','1000',2);
insert
into games values('1002','1001',5);
insert
into games values('1002','1002',6);
insert
into games values('1002','1003',7);
insert
into games values('1003','1000',3);
insert
into games values('1003','1002',3);
insert
into games values('1003','1003',3);
drop
table athlete;
create
table athlete (
ano char(10) not
null
primary
key,
aname char(20),
a*** char(5),
ateam char(16)
);
create
view a as
select * from athlete
where ateam='大連';
create
user user1 identified by
123456;
grant
update(score) on games to user1;
select item.ino, iname, itime, iplace
from item, athlete, games
where item.ino = games.ino and athlete.ano = games.ano and athlete.ano = '1002'
order
by itime;
select games.ano, aname, a***, ateam
from athlete, games
where games.ano = athlete.ano and games.ino = '1000';
select ateam, count(ano)
from athlete
where a*** = '男'
group
by ateam;
select iname from item where iplace != '1';
select athlete.ano from
(select count(*) as cou from item) temp,
athlete,
(select ano, count(*)
as cou2 from games group
by ano) temp2
where temp2.ano = athlete.ano and cou2 = cou;
select aname from
athlete,
(select ano, count(*) as cou from games group
by ano) temp2
where temp2.ano = athlete.ano and cou >= 3
and a*** = '女';
select aname, score
from games, athlete, item
where athlete.ano = games.ano and games.ino = item.ino and iname = '跳高';
select s.sno from
(select s.sno as sn, count(*) as cu from sc, s where sc.sno = s.sno group
by s.sno) t,
(select sno, count(*) as cu1 from sc
where cno != all(select cno from sc, s where sc.sno = s.sno and s.sno = '801')
group
by sno) t1,
(select
count(*) as cu2 from sc, s
where sc.sno = s.sno and s.sno = '801'
group
by s.sno) t2,
swhere
t.sn = s.sno
and(
(t1.sno = s.sno
andt.cu - t1.cu1 = t2.cu2)
ort.cu = t2.cu2);
運動員指派問題
用lingo解決 運動員指派問題 如下 model 運動員指派問題 5 persons and 4 jobs assignment problem sets person 1.5 job 1.4 assign person,job c,x endsets here are the parameter...
運動員名次問題
5位運動員參加了10公尺臺跳水比賽,有人讓他們 比賽結果 a選手說 b第二,我第三 b選手說 我第二,e第四 c選手說 我第一,d第二 d選手說 c最後,我第三 e選手說 我第四,a第一 比賽結束後,每位選手都說對了一半,請程式設計確定比賽的名次。如下 但是這裡會出現乙個問題,你會發現好多重複的名字...
運動員最佳配對問題
西安交大 軟體53 蔡少斐 題號 6 5 題目敘述 羽毛球隊有男女運動員各n人。給定2個n n矩陣p和q。p i j 是男運動員i和女運動員j配對組成混合雙打的男運動員競賽優勢 q i j 是女運動員i和男運動員j配合的女運動員競賽優勢。由於技術配合和心理狀態等各種因素影響,p i j 不一定等於q...