Viewing Table Structure with the DESCRIBE Command

The handy DESCRIBE command enables you to view the structure of a table quickly without having to create a query against the data dictionary.

						DESC[RIBE] table_name
					

Take a look at the two tables you will be using throughout the day:

SQL> describe orders

 Name                            Null?    Type
 ------------------------------- -------- ----
 ORDER_NUM                       NOT NULL NUMBER(2)
 CUSTOMER                        NOT NULL VARCHAR2(30)
 PRODUCT_ID                      NOT NULL CHAR(3)
 PRODUCT_QTY                     NOT NULL NUMBER(5)
 DELIVERY_DATE                            DATE

The following statement uses the abbreviation DESC instead of DESCRIBE:

SQL> desc products Name Null? Type ------------------------------- -------- ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.