MySQL表具有固定的行数? [英] MySQL table with fixed number of rows?

查看:143
本文介绍了MySQL表具有固定的行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有桌子documents (id, name, time).是否有特殊的sql命令将表限制设置为10行?

I have table documents (id, name, time). Is there a special sql command to set table limit by 10 rows?

推荐答案

如果只想显示最新生成的10个文档",则不需要单独的表.只需在现有表上使用查询即可:

If you just want to display the "latest 10 generated documents", no need for a separate table. Just use a query on your existing table:

SELECT id, name, `time`
FROM documents
ORDER BY `time` DESC
LIMIT 10

这篇关于MySQL表具有固定的行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆