SQL习题limit、offset用法

    技术2023-12-17  97

    SQL习题(limit、offset)

    select distinct #distinct 作用查出所查列不重复的数据 Salary SecondHighestSalary from Employee order by SecondHighestSalary #顺序排列数据(默认升序排列) desc #降序操作 limit 1 #limit 检索第一条数据 offset 1 #跳过第一行数据

    注意

    limit用法:

    后面跟一个参数,表示检索第几条数据。后面跟两个参数,表示从第几行+1开始查多少条数据。
    Processed: 0.029, SQL: 9