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) ;
...全文
128 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
msuxx 2006-03-14
  • 打赏
  • 举报
回复
没有人回答吗/
msuxx 2006-03-14
  • 打赏
  • 举报
回复
麻烦说下原因,新手呀

34,587

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧