Duplicates 的问题?
msuxx 2006-03-14 01:06:13 我有sql如下:请大家看看这几个有没有duplicates.
a.----------------
select S.name
form student S
where S.id like ‘1’
b.-----------------
select S.id
from student S, faculty F
where S.address = F.Address
c.-----------------
select C.Crscode,COUNT(*)
from transcript T
GROUP BY T.CrsCode
表结构如下:
Drop table student;
create table student
(
StId char(9) not null,
StName char(20) not null,
StAddress char(50)not null,
StStatus char(10) Default 'freshman'
);
create unique index student_idx1 on student (StId) ;
Drop table faculty;
create table faculty
(
Id integer not null,
Name char(20)not null,
DeptId char(10) not null,
Address char(50)
);
create unique index professor_idx1 on professor (Id) ;
Drop table course;
create table course
(
DeptId char(10),
CrsCode char(6),
Crsname char(20),
Descr char(50)
);
Primary key (crscode);
unique( Deptid,crsName);
Drop table transcript;
create table transcript
(
studId integer,
CrsCode char(6),
sectionno integer,
Semeater char(6),
Grade char(1),
year integer
);
PRIMARY key(Studid,crscode,sectionNo,semester,Year),
ForEIGN KEY(STUDID)
FOREIGN KEY(crscode,sectionNo,semester,Year)
Drop table teaching;
Create table Teaching(
ProfId integer,
CrsCode char(6),
Semester char(6)
);
create unique index teaching_idx1 on teaching (CrsCode,Semester) ;