List tables that have specific string
I am wanted to list tables from my database, but only tables that contain a certain string.
Say I have a database with four tables:
I want to be able to list all tables that contain 'car'.
Any help is greatly appreciated
After more searching, I found what I am looking for. In case anyone else find this when trying to do the same thing:
$sql = "SHOW TABLES FROM demonsi1_db LIKE '%_gallery'";
$do_sql = mysql_query($sql);
while($row = mysql_fetch_array($do_sql))
echo $row['0'] . "<br>";
In asking for help on databases I always advise to indicate what database you are using.
In MS SQL you have
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '<SCHEMA>' AND TABLE_NAME LIKE '%<STRING>%'
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread