The describe command is used to view detailed design information for a specific table
For example, to view the design information for the guestbook table, use:
Describe Guestbook
describe Ol_user userid
Second, you can view the column names of the tables in the database through "show Comnus"
There are two ways of using it:
Show columns form table name from database name
Or:
Show columns from database name. Table Name
Third, the use of describe command to query specific columns of information
is the column information for the ID field in the query guestbook
{DESCRIBE | DESC} tbl_name [Col_name | wild]
DESCRIBE is the abbreviation for show COLUMNS from.
DESCRIBE provides column information about a table. Col_name can be a column name or a string that contains the SQL wildcard character "%" and "_". It is not necessary to enclose the string in quotation marks.
Mysql> desc Ol_user username\g
1. Row ***************************
field:username
type:varchar (MB)
null:no
key:mul
Default:
Extra:
1 row in Set (0.02 sec)
Determine whether the field exists
mysql_connect (' localhost ', ' root ', ' root ');
mysql_select_db (' demo ');
$test = mysql_query (' Describe cdb_posts a ');
$test = Mysql_fetch_array ($test);
$test [0] Returns the name of the field, for example, I want to query the top field and return the top
If this field does not exist, the return is null, by which you can determine whether a field exists