How can I get column names from a table in Oracle

Blog-36.jpg

In this blog, we will learn how to get column names from a table in Oracle. Oracle is a database software that uses the Relational database management concept, which means we can store the data in the form of tables.

Table of Contents:

How can I get column names from a table in Oracle?

In Oracle, you can get column names from the table with the following syntax:

Syntax

SELECT column_name 
FROM user_tab_columns 
WHERE table_name = 'YOUR_TABLE_NAME';

Explanation:

  • user_tab_clumns: it is a dictionary view in Oracle, that provides the information about the columns present in a table.
  • table_name = ‘YOUR_TABLE_NAME’: this filters the row where the table name is equal to “YOUR_TABLE_NAME”.

Example to get column names from a table in Oracle

Suppose we have a table Employee that has some data in it.

Table: Employee

ID Name Dept
1ClarkSales
2JohnHR
3PiyushOps
4OliveIT

Now, If you want to print all the columns from the table, let’s run the following Query:

Query:

SELECT column_name 
FROM all_tab_columns 
WHERE table_name = 'Employee' order by column_name;

Output:

COLUMN_NAME
--------------------------------------------------------------------------------
DEPT
EMPID
NAME

Conclusion

So far in this article, we have learned how we can get column names from a table in Oracle with an example. If you want to excel in your career in SQL, you should visit our SQL course.

About the Author

Technical Content Writer | Software Developer

Nirnayika Rai is a Software Engineer and Technical Content Writer with experience in full-stack development, cloud platforms, and software systems. She creates clear, well-structured content that helps developers understand and apply technical concepts with confidence. Her work combines coding knowledge with a strong focus on clarity, accuracy, and practical relevance.

Intellipaat