Ragavendran Ramesh
Ragavendran Ramesh

Reputation: 358

Mysql - How to Give Alias name for column

I am getting the list of tables that matches the query string from the database.

My Query

show tables like '%fit%'

Output

Tables_in_pdi (%fit%)

fit_types

In PHP while i am fetching these , i am getting the output as

Array ( [Tables_in_pdi (%fit%)] => fit_types )

If there is an anyway to give alias for these , so that it will be easy for me to take the data in php

Upvotes: 1

Views: 139

Answers (1)

user557846
user557846

Reputation:

it would be easier to use the INFORMATION_SCHEMA database:

http://dev.mysql.com/doc/refman/5.0/en/tables-table.html

SELECT table_name FROM INFORMATION_SCHEMA.TABLES
  WHERE table_schema = 'DB_NAME'
  AND table_name LIKE '%fit%'

Upvotes: 2

Related Questions