In Oracle SQLPlus, which command displays the structure (columns, types, nullability) of a table?

Difficulty: Easy

Correct Answer: DESCRIBE [TableName].

Explanation:

Introduction / Context:DBAs and developers frequently need to inspect a table’s definition (column names, data types, length, and nullability). SQLPlus provides a built-in command to display this metadata quickly.

Given Data / Assumptions:

  • The environment is SQLPlus or a client that supports DESCRIBE syntax.
  • We want the canonical, supported syntax to view a table’s structure.

Concept / Approach:SQLPlus uses the DESCRIBE command (abbreviated DESC). The correct form is DESCRIBE table_name. The client interprets this meta-command and queries the data dictionary to show columns and attributes.

Step-by-Step Solution:

Enter: DESCRIBE EMP (for example).Observe output listing column name, type, and nullable status.Use DESC as a shorthand in many Oracle tools.

Verification / Alternative check:Equivalent information can be retrieved from USER_TAB_COLUMNS or ALL_TAB_COLUMNS; however, DESCRIBE is the direct SQLPlus method.

Why Other Options Are Wrong:STRUCTURE and DESCRIBE STRUCTURE are not SQLPlus commands. DESC TABLE [TableName] adds the word TABLE unnecessarily; the standard form is simply DESC or DESCRIBE followed by the object name.

Common Pitfalls:Confusing DESCRIBE with DDL statements; DESCRIBE is a client command, not standard SQL.

Final Answer:DESCRIBE [TableName].

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion