I have an MySQL table with 25000 rows.
This is an imported CSV file so I want to look at the last ten rows to make sure it imported everything.
However, since there is no ID column, I can't say:
SELECT * FROM big_table ORDER BY id DESC
What SQL statement would show me the last 10 rows of this table?
The structure of the table is simply this:
columns are: A, B, C, D, ..., AA, AB, AC, ... (like Excel)
all fields are of type TEXT
All the answers here are better, but just in case... There is a way of getting 10 last added records. (though this is quite unreliable :) ) still you can do something like
SELECT * FROM table LIMIT 10 OFFSET N-10
N
- should be the total amount of rows in the table (SELECT count(*) FROM table
). You can put it in a single query using prepared queries but I'll not get into that.Select from the table, use the ORDER BY __ DESC to sort in reverse order, then limit your results to 10.
SELECT * FROM big_table ORDER BY A DESC LIMIT 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With