How to generate Data dictionary in MySql

in mysql / 5 Comments

In this post I am going to explain about how to generate Data dictionary in MySql database. In the earlier posts we learned about installation of MySql, import and export databases , MySql table schema, MySql database backup and MySql views. We can have simple query which will in below code and change database name with yours then you will get data dictionary of your database in MySql.

How to generate Data dictionary in MySql by Anil Kumar Panigrahi

How to generate Data dictionary in MySql by Anil Kumar Panigrahi

MySql Code:

select t.table_schema as db_name,  
(case when t.table_type = 'BASE TABLE' then 'table'
when t.table_type = 'VIEW' then 'view' 
else t.table_type  
end) as table_type,
from information_schema.tables as t
inner join information_schema.columns as c 
on t.table_name = c.table_name 
and t.table_schema = c.table_schema
where t.table_type in('base table', 'view')
and t.table_schema = '<database name>' 
order by t.table_schema, t.table_name, c.ordinal_position

Note: < database name > change it with your database name.

With more than 9 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ...Contact : [email protected]

Discussion 5 Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>