$sql = "show create table category";
$res = mysql_query($sql) or die(mysql_error());
while($obj=mysql_fetch_object($res))
...{
print_r($obj);
echo "}
Output
stdClass Object
(
[table] => category
[CREATE TABLE] => create TABLE ' category ' (
' CategoryID ' int ' unsigned NOT null default ' 0 ',
' categoryname ' varchar ' is not null default ',
' parentid ' int (a) unsign Ed NOT null default ' 0 ',
' Keywords ' varchar (255) isn't null default ',
' ProductCount ' mediumint (6) unsigned not NUL L default ' 0 ',
' Tradeleadcount ' mediumint (6) NOT null default ' 0 ',
' Companycount ' mediumint (6) NOT null default ' 0 ',
' B2soutletcount ' mediumint (6) unsigned NOT null default ' 0 ',
' categorytype ' tinyint (1) NOT null default ' 0 ',
' section ' tinyint (1) unsigned NOT null default ' 0 ',
' isleaf ' tinyint (1) NOT null default ' 1 ',
' Link ' int (a) uns igned not NULL default ' 0 ',
PRIMARY key (' CategoryID '),
Key ' groupname ' (' CategoryName '),
KEY ' parentid ' (' Par Entid '),
Key ' CategoryType ' (' CategoryType '),
Key ' section ' (' section ')
) Engine=myisam DEFAULT charset= Latin1
)
Mysql>tee Outmsg.log--note that the structure that is executed later on the command line is entered into the Outmsg.log file
Mysql>? Show
Name: ' Show '
Description:
Show has many forms that provide information about databases, tables,
columns, or status information about the server. This section describes
Those following:
Show [All] COLUMNS from tbl_name [to db_name] [like ' pattern ']
Show CREATE DATABASE db_name
Show CREATE FUNCTION funcname
Show CREATE PROCEDURE procname
Show CREATE TABLE tbl_name
Show DATABASES [as ' pattern ']
Show ENGINE Engine_name ... {LOGS | STATUS}
Show [STORAGE] Engines
Show ERRORS [LIMIT [Offset,] row_count]
Show FUNCTION STATUS [like ' pattern ']
Show grants for user
Show INDEX from Tbl_name [from Db_name]
Show INNODB STATUS
Show PROCEDURE STATUS [as ' pattern ']
Show [BDB] LOGS
Show PLUGIN
Show privileges
Show [Full] Processlist
Show [GLOBAL | Session] STATUS [like ' pattern ']
Show TABLE STATUS [from db_name] [like ' pattern ']
Show [OPEN] TABLES [from db_name] [as ' pattern ']
Show triggers
Show [GLOBAL | Session] VARIABLES [as ' pattern ']
Show warnings [LIMIT [offset,] row_count]
The show statement also has forms that provide information about
Replication master and slave servers and are described in
[Replication-sql]:
Show Binlog EVENTS
Show MASTER LOGS
Show MASTER STATUS
Show SLAVE HOSTS
Show SLAVE STATUS
If The syntax for a given show statement includes a as ' pattern '
Part, ' pattern ' are a string that can contain the SQL '% ' and ' _ '
Wildcard characters. The pattern are useful for restricting statement
Output to matching values.
Several show statements also accept a WHERE clause so provides more
Flexibility in specifying which rows to display. [Extended-show].