sql面试题(查看数据中指定几行记录)_MySQL
Jun 01, 2016 pm 01:16 PM分享一个sql数据库面试题。
问题:
表 table1,主键为 ID,ID为自动编号(ID可能不连续),要求查询第31-40行记录,请问SQL语句怎么写?
实现代码:
--SQL server
select top 10 *
from
(select top 40 * from table1 order by ID) a
order by ID desc
--Oracle
select *
from
(select top 40 * from t order by ID) a
where
rownum>30

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Where can I view the records of things I have purchased on Pinduoduo? How to view the records of purchased products?

How to view and manage Linux command history

How to check call history in iPhone and export it?

C# Development Advice: Logging and Monitoring Systems

How to log and monitor Java development projects

How to view your medication log history in the Health app on iPhone

Steps to install SQL Server 2021 Developer Edition on Windows 11

How to record running kilometers in keep? Where is the running track recorded?
