{"id":47,"date":"2006-05-03T22:42:49","date_gmt":"2006-05-04T03:42:49","guid":{"rendered":"\/cgi\/wp\/?p=47"},"modified":"2006-05-03T22:44:48","modified_gmt":"2006-05-04T03:44:48","slug":"information-schema","status":"publish","type":"post","link":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/?p=47","title":{"rendered":"Information Schema"},"content":{"rendered":"<p>Yesterday I blogged about how to document a MySQL database by a rather involved process of importing the database into SQL Server and then Microsoft Access. Actually you could simply use <b>phpMyAdmin 2.5.0<\/b> to display the same information by clicking the <i>Structure<\/i> and then the <i>Data Dictionary<\/i> links. However importing a MySQL database into SQL Server and Microsoft Access is still a useful task. <\/p>\n<p><b>phpMyAdmin 2.5.0<\/b> probably queries the information_schema table to obtain its information about the database design. The information_schema is a special database table that contains data about all the other databases and tables on the database server. Querying the  information_schema table can be very useful for dynamically generating code. You could construct tedious INSERT and UPDATE SQL statements or stored procedures based on this information.  I have found the correct syntax for running information_schema queries on SQL Server and MySQL:<\/p>\n<h2>SQL Server Queries<\/h2>\n<p>SELECT table_name FROM information_schema.tables WHERE table_catalog = &#8216;dbName&#8217;<br \/>\n<i>tables in a database<\/i><\/p>\n<p>SELECT column_name, data_type, numeric_precision, character_maximum_length,is_nullable, column_default<br \/>\nFROM information_schema.columns<br \/>\nWHERE table_name = &#8216;tableName&#8217;<br \/>\n<i>columns in a database<\/i><\/p>\n<h2>MySQL Queries<\/h2>\n<p>select table_name, create_time from information_schema.tables where table_schema = &#8216;books&#8217;<br \/>\n<i>tables in a database<\/i><\/p>\n<p> select column_name, data_type, numeric_precision, character_maximum_length,is_nullable, column_default from information_schema.columns where table_name = &#8216;reading&#8217;<br \/>\n<i>columns in a database<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday I blogged about how to document a MySQL database by a rather involved process of importing the database into SQL Server and then Microsoft Access. Actually you could simply use phpMyAdmin 2.5.0 to display the same information by clicking &hellip; <a href=\"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/?p=47\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/posts\/47"}],"collection":[{"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=47"}],"version-history":[{"count":0,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions"}],"wp:attachment":[{"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}