I have table documents (id, name, time)
. Is there a special sql command to set table limit by 10 rows?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- sqlyog export query result as csv
So, if you have a table like this:
then you can use this horrible query to limit row numbers by recycling the row having the lowest
id
field:Somebody please confirm if this query is atomic, i think it is, but who knows…
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:
no you could not set a limit on the mysql table, you can achive this with trigger that delete rows.