with 物理前十 as
(
select s.student_id,
s.name,
sc.score,
rank() over (order by sc.score desc)as ranking
from students s
join scores sc
on s.student_id=sc.student_id
where s.grade_code = 'S1'and sc.subject = '物理'
)
select student_id, name, score, ranking from 物理前十
limit 10
with 物理前十 as
(
select s.student_id,
s.name,
sc.score,
rank() over (order by sc.score desc)as ranking
from students s
join scores sc
on s.student_id=sc.student_id
where s.grade_code = 'S1'and sc.subject = '物理'
)
select student_id, name, score, ranking from 物理前十
with 物理前十 as
(
select s.student_id,
s.name,
sc.score,
rank() over (order by sc.score desc)as 排名
from students s
join scores sc
on s.student_id=sc.student_id
where s.grade_code = 'S1'and sc.subject = '物理'
)
select student_id, name, score, 排名 from 物理前十
with 物理前十 as
(
select s.student_id,
s.name,
sc.score,
rank() over (order by sc.score desc)as 排名
from students s join scores sc on s.student_id=sc.student_id
where s.grade_code='S1'and sc.subject='物理'
)
select student_id, name, score, 排名 from 物理前十
with 物理前十 as
(
select s.student_id, s.name, sc.score, rank() over (order by sc.score)as 排名
from students s join scores sc on s.student_id=sc.student_id
where s.grade_code='S1'and sc.subject='物理'
)
select student_id, name, score, 排名 from 物理前十
with 物理前十 as
(
select
s.student_id,
s.name,
sc.score,
rank() over(order by sc.score desc) as 排名
from students s join scores sc on s.student_id=sc.student_id
where s.grade_code='s1' and sc.subject='物理'
)
select student_id,
name,
score,
排名
from 物理前十
limit 10
with 物理前十 as
(
select
s.student_id,
s.name,
sc.score,
rank() over(order by sc.score desc) as 排名
from students s join scores sc on s.student_id=sc.student_id
where s.grade_code='s1' and sc.subject='物理'
)
select student_id,
name,
score,
排名
from 物理前十
with 物理前十 as
(
select
s.student_id,
s.name,
sc.score,
rank() over(order by sc.score desc) as 排名
from students s join scores sc on s.student_id=sc.student_id
where s.grade_code='s1' and sc.subject='物理'
)
select student_id,
name,
score,
排名
from 物理前十
limit 10;
WITH 物理前十 AS (
SELECT
s.student_id,s.name,sc.score,
row_number()
over(partition by s.grade_code ORDER BY sc.score DESC) AS 排名
FROM
students s
JOIN
scores sc ON s.student_id = sc.student_id
WHERE
s.grade_code = 'S1'
AND sc.subject = '物理'
)
SELECT
student_id,
name,
score,
排名
FROM
物理前十
limit 10;
select s.name,s.class_code,s.grade_code,t.name AS head_teacher_name
from students s join teachers t ON s.class_code=t.head_teacher
order by student_id;
select s.name, s.class_code, s.grade_code, t.name AS head_teacher_name
from students s JOIN teachers t on s.class_code = t.head_teacher
order by s.student_id;
select s.name,s.class_code,s.grade_code,t.name AS head_teacher_name
from students s JOIN teachers t on s.class_code = t.class_code
order by s.student_id;