问题
I have a table named rabbits. I am trying to find the average row length in my table. I tried this query:
SELECT AVG_ROW_LENGTH(rabbits)
but it doesn't work.
回答1:
My Googling has indicated that AVG_ROW_LENGTH
is actually a column in information_schema.tables. You'll want to try something like this, I think:
SELECT AVG_ROW_LENGTH FROM information_schema.tables WHERE TABLE_NAME = 'rabbits';
You may also need to specify the database name by adding "AND TABLE_SCHEMA = 'databasename';" if you have more than one database with a rabbits table.
Hope this helps!
回答2:
You can't SELECT that, try this instead:
SELECT Avg_row_length FROM information_schema.tables WHERE table_name='rabbits';
来源:https://stackoverflow.com/questions/34321608/mysql-querying-average-row-length