mysql search for segment of table name

I'm trying to select tables in a mysql database which have the same ending, e.g. staff_name, manager_name, customer_name (example). I was thinking of something along the lines of the following because it works if I have a definite table name.

SELECT * FROM "%_name";

I also tried this using a % instead of the _ with no luck. I'm not sure if there are other wildcards I could try. I've looked around, but none of the results seem to apply to parts of table names :/ Any suggestions?

Answers


SELECT TABLE_NAME 
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME like '%_name'
and TABLE_SCHEMA = 'your_db_name'

If you want to search for tables in your current DB you can do

SHOW TABLES LIKE '%_name'

you can do in 3 way

show tables like '%yourtablename'
show tables like '%yourtablename%'

show tables like 'yourtablename%'

Need Your Help

How to cancel a drop action for jQuery droppable?

jquery-ui droppable

I have a jQuery UI droppable which accepts draggables. I want to not allow the drop action if certain conditions are met.

What is firebase and how to use it in Android?

java android firebase firebase-hosting firebase-realtime-database

I want to create an android app, where I, as an author, upload my college notes and anyone can download it. I read that firebase can help me with this. Can anyone please explain what is firebase an...