Mysql Describe Table
Describe employeetable describe a table in a different schema with a case sensitive name.
Mysql describe table. Create table products productid int10. Sql create clause as the name suggests describe is used to describe something. Describe app describe all the columns in the current schema. Describe statement to get following information.
We can use either describe or descboth are case insensitive. Login to the mysql database server. There are at least two ways to get a mysql tables structure using sql queries. Mysql 80 reference manual tutorial getting information about databases and tables 34 getting information about databases and tables what if you forget the name of a database or table or what the structure of a given table is for example what its columns are called.
The describe and explain statements are synonyms used either to obtain information about table structure or query execution plans. Switch to a specific database. With database size precision and if numeric datatype scale. This post deals with the describe function and the next mysql post looks at the informationschema.
Sql desc statement describe table sql desc statement use for describe the list of column definitions for specified table. The following example demonstrates how to display columns of the orders table in the classicmodels database. Sql desc syntax. The desc is the short form of describe command and used to dipslay the information about a table like column names and constraints on column name.
Use the describe statement. Both are return same result. Column allow null or not null. You can use either desc or describe statement.
Since in database we have tables thats why we use describe or descboth are same command to describe the structure of a table. Mysql create table testtid int tname varchar20 tpassword char32 tbirth date. To show all columns of a table you use the following steps. Describe myuserorders describe all the columns from all the tables and views in app schema.
Describe user2flights describe a table whose name is in mixed case. The example table used in this post was created with the following sql. Describe a table in another schema. Datatype of the column.
For more information see section 13755 show columns statement and section 1382 explain statement.