How get column name – Mysql

Posted: October 6, 2011 in IT and Programming Stuff
Tags:

SELECT column_name FROM information_schema.COLUMNS WHERE table_name = 'table_name';

Tambahan, kadang karena sudah terlalu besarnya skema database yang kita punya, dan saking banyaknya tabel di dalamnya, kita lupa tabel apa ya yang punya column = ‘column_x’ misalnya.

Nah, kalau untuk yang itu, ini solusinya :

SELECT table_name FROM information_schema.COLUMNS WHERE column_name LIKE ‘%column_name%’

Fungsi-fungsi lainnya silahkan dibaca sendiri di manual Mysql, hehe😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s