SQL Statements
DESCRIBE statement
Overview
Describe
statement show columns within a table and tables within a database.
The
Describe
statement is recommended to use before creating a new table to avoid duplicate tables.Syntax
Describe Database
Below is the basic syntax for describing tables within a database:
Describe Table
Below is the basic syntax for describing columns within a table:
table_name
is the name of the table that you want to show.
Examples
To get a better understanding of a DESCRIBE
statement, take a look at some examples below:
Case #1: Describe Table
- In this example, we will figure out the columns of a part table. Run the query below:
- As a result, you will get a list of column names, column types, and nullable options from the part table.
The example above shows that the tables reside in the
public
schema, the default schema in Oxla. You can also have a table from other schemas - click here for more info.Case #2: Describe Database
- Execute the following query to describe the database:
- You will retrieve a list of the existing tables in the database as shown below: