SQL经典案例

Laeni
2022-11-30

  • 查询每个班前三名

    create table test_score
    (
        CLASS VARCHAR(10),
        NAME  VARCHAR(10),
        SCORE INTEGER
    );
    
    select class, name, score
    from test_score a
    where (select count(*) from test_score where class = a.class and a.score < score) < 3;
    

发现错误或想为文章做出贡献? 在 GitHub 上编辑此页面!
© 2020-2025 All Right Reserved 滇ICP备17005647号-2