desc Verified current stable Not installed? Data Processing

Desc / Describe Table In Current Project

Describe Table In Current Project

Displays the schema of a specific table including column data types.

$
Terminal
desc <table_name>;

When To Use

When validating table structure before data manipulation tasks.

Pro Tip

Use the `extended` flag with DESC for additional details on indexed columns, though this may increase latency.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
desc <table_name>;

Anatomy of Output

Understanding the result

+--------------+-----------+------+-----+---------+-------+ Row Separator

Indicates the start of the table schema.

| Field | Type | Null | Key | Default | Extra | Header Row

Definitions of column attributes.

+--------------+-----------+------+-----+---------+-------+ Separator

Partition between header and data.

| id | int(11) | NO | PRI | NULL | | Column Entry

`id` is a primary key, cannot be NULL.

| username | varchar(50) | YES | | NULL | | Column Entry

`username` can be NULL, holds string data.

+--------------+-----------+------+-----+---------+-------+ Row Separator

End of the schema.

Troubleshooting

Common pitfalls

ERROR 1146 (42S02): Table 'xyz.table_name' doesn't exist

Solution: Confirm the table name and check the database context.

ERROR 1064 (42000): You have an error in your SQL syntax;

Solution: Ensure proper syntax, avoid using reserved words as table names.

ERROR 1045 (28000): Access denied for user 'user'@'localhost' (using password: YES)

Solution: Check user permissions for the database.

Command Breakdown

What each part is doing

desc
Base Command
The executable that performs this operation. Here it runs Desc before the shell applies any redirect operators.
<table_name>
table name
The value supplied for table name.

Alternative Approaches

Comparable commands in other tools

Alternative data processing tools for the same job.