. tblStudentsMarks, , .
CREATE TABLE tblStudent(
studentId INT identity(1,1) primary key,
Name varchar(50),
filler char(2000));
create nonclustered index ix on tblStudent (StudentId, Name);
Insert into tblStudent (Name)
select top 10000 newid()
from sys.objects s1,sys.objects s2,sys.objects s3,sys.objects s4;
CREATE TABLE tblStudentsMarks(
examid int not null
,studentId INT foreign key references tblStudent not null
,marks decimal(5,2) not null
,primary key clustered (studentId, examid))
insert into tblStudentsMarks
select abs(checksum(newid())) as examid, studentId ,abs(checksum(newid()))/10000000 as marks
from tblStudent cross join (select top 5 1 C from sys.objects) d
where studentid % 3 =0

* Query 1 Select s.studentId, s.Name, sm.Sum, .