MariaDB - 限制查询(Limit)

MariaDB - 限制查询(Limit) 首页 / MariaDB入门教程 / MariaDB - 限制查询(Limit)

在MariaDB数据库中,SELECT语句与LIMIT子句一起使用可从表中检索一个或多个记录。

语法:

SELECT expressions
FROM tables
[WHERE conditions]
[ORDER BY expression [ ASC | DESC ]]
LIMIT row_count; 

示例1:  以降序(desc)检索记录:

让无涯教程在"Students"表中将SELECT语句与LIMIT子句一起使用。结果以降序显示,LIMIT为4。

SELECT student_id, student_name, student_address
FROM Students
WHERE student_id <= 7
ORDER BY student_id DESC
LIMIT 4;

输出:

链接:https://www.learnfk.comhttps://www.learnfk.com/mariadb/mariadb-select-limit.html

来源:LearnFk无涯教程网

Mariadb Select limit 1

示例2:  按升序(asc)检索记录:

SELECT student_id, student_name, student_address
FROM Students
WHERE student_id <= 7
ORDER BY student_id ASC
LIMIT 4;

输出:

链接:https://www.learnfk.comhttps://www.learnfk.com/mariadb/mariadb-select-limit.html

来源:LearnFk无涯教程网

Mariadb Select limit 2

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

OpenResty从入门到实战 -〔温铭〕

研发效率破局之道 -〔葛俊〕

Node.js开发实战 -〔杨浩〕

罗剑锋的C++实战笔记 -〔罗剑锋〕

TensorFlow 2项目进阶实战 -〔彭靖田〕

数据分析思维课 -〔郭炜〕

深入浅出分布式技术原理 -〔陈现麟〕

中间件核心技术与实战 -〔丁威〕

运维监控系统实战笔记 -〔秦晓辉〕

好记忆不如烂笔头。留下您的足迹吧 :)