Show table structure in SQL

Can someone explain me a little better? How to show the structure of the table? I ran select * from table ; and of course, it displays everything in the table. But I am asked to show the structure of the table. What does this mean and what is the team?

Here is my table below.

 SQL> select * from dept; DEPTNO DNAME LOC ---------- -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> 
+6
source share
2 answers

To display columns and data types, I usually use

 SELECT COLUMN_NAME, DATA_TYPE FROM ALL_TAB_COLUMNS WHERE TABLE_NAME='your_table_name'; 

It's been a while since I worked with Oracle. ALL_TAB_COLUMNS may be ALL_TAB_COLS .

If you need to show the full CREATE TABLE statement, see How to get Oracle to create a table statement in SQL * Plus

+10
source

Try: describe table_name

+8
source

Source: https://habr.com/ru/post/896935/


All Articles