How to apply pagination to the result of SHOW TABL

2020-03-01 08:02发布

问题:

I would like to apply pagination to the results of SHOW TABLES FROM DATABASE_NAME.

Tried using the LIMIT keyword but an error is thrown.

By pagination I mean that the result(tables) returned by the query is to be displayed on multiple pages.

回答1:

you can use the different query instead (an achieve the names of the tables) like:

    SELECT TABLE_NAME FROM information_schema.TABLES 
WHERE `TABLE_SCHEMA` = 'my_db_name' LIMIT 10


回答2:

mysql> pager less;

mysql> show tables;



回答3:

You can try following

1)

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES 
WHERE TABLE_SCHEMA = 'database_name' 
AND TABLE_NAME LIKE "a%" 
LIMIT 0,20;

2)

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES 
WHERE TABLE_SCHEMA = 'database_name'  
LIMIT 0,50;