0

1) 以下のスクリプトによって作成された 2 つのテーブルがあります。あなたは、平均点が最大の学生のリストを表示する SQL クエリを作成する任務を負っています。次の制限がある 2 つの解決策を提供してください a) サブクエリもカーソルも追加テーブルも使用できません b) サブクエリもカーソルも追加テーブルも GROUP BY 句も使用できません

create table Students
(ID int identity(1,1) primary key not null,
 StudentName varchar(200) not null,
 );

create table StudentMarks
(ID int identity (1,1) primary key not null,
 Student_ID int not null references Students (ID),
 Mark int not null check (mark between 1 and 5));

 insert into Students 
 (StudentName)
 values 
 ('Ivanov'),
 ('Petrov'),
 ('Sydorov'),
 ('Semenov');


 insert into StudentMarks
 (Student_ID,Mark)
 values
 (1,3), (1,4), (1,3), (1,5),
 (2,3), (2,4), (2,3), (2,5),
 (3,3), (3,3), (3,5), (3,3)

これが私がこれまでに試したことです:

select Student_ID 
from StudentMarks 
where MAX(AVG(Mark))=AVG(Mark) 
GROUP BY Student_ID
4

0 に答える 0