MySQL - querying average row length

你。 提交于 2019-12-07 10:33:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!