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

In Oracle, you can get the column names of a table using the "ALL_TAB_COLUMNS" data dictionary view. The "ALL_TAB_COLUMNS" view contains one row for each column of each table, view, or materialized view in the database that is accessible to the current user.

You can query the "ALL_TAB_COLUMNS" view to get the column names of a specific table by filtering on the table name and the owner name. Here is an example query that gets the column names of the "EMPLOYEES" table:

SELECT column_name
FROM all_tab_columns
WHERE table_name = 'EMPLOYEES'
AND owner = 'SCOTT';

This query will return the column names of the employees table owned by the user scott.

If you are the owner of the table or have the appropriate privileges, you can also use the "DBA_TAB_COLUMNS" view or "USER_TAB_COLUMNS" view instead of "ALL_TAB_COLUMNS" which will provide you the same information but only for the tables you own or have access to respectively.

You can also use the DESCRIBE command in SQL*Plus or SQL Developer to view the columns and their data types of a table.

DESCRIBE employees;

This will return the same information as the above query. It's important to note that these views only return the column names and not the data types. For this, you can use the above query and join the result with "ALL_TAB_COLS" or "USER_TAB_COLS" views to get the data types of the columns.