Reputation: 2663
Hi am having a query in mysql as follows show tables like 'stud%'
, Suppose i want to give an alias over that how can it be done.
I tried the following
show tables like 'stud%' as stud_tables
. Its not working.
Is it possible..?am not sure..Anyway i just need to give a column name as part of the list am getting when i execute the first query.. show tables like 'stud%'
Upvotes: 0
Views: 3982
Reputation: 14616
Maybe you could try the more complex way using the [INFORMATION_SCHEMA
database][1]:
http://sqlfiddle.com/#!2/0d110/6
SELECT t.TABLE_NAME AS stud_tables
FROM INFORMATION_SCHEMA.TABLES AS t
WHERE t.TABLE_TYPE = 'BASE TABLE' -- exclude system tables
AND t.TABLE_SCHEMA = 'db_0d110' -- database name
AND t.TABLE_NAME LIKE 'stud%' -- table name
http://dev.mysql.com/doc/refman/5.0/en/tables-table.html
Upvotes: 2