0

I'm studying DDBB and we are using Oracle. Using too much tables can be really difficult for me because I have to remember table1.content2, table3.content1, etc.

So because of that, I would like to print (in paper) the header tables to make it easier.

I know my explanation is not very good so I tried to "draw it" below:

select * from user_tables;

table_name|
-----------
table1    |
-----------
table2    |
-----------
table3    |

What I want:

table1
-----------------------------
content1| content2| content3|

table2
-----------------------------
content1| content2| content3|

table3
-----------------------------
content1| content2| content3|

How can I get this in paper?

Thanks!

0

You can do a describe using SQLplus or SQL Developer: desc myschema.mytable This way you'll also see the column's datatype and whether it can be null or not.

desc myschema.category

Name           Null     Type           
-------------- -------- -------------- 
CATEGORY_ID    NOT NULL NUMBER(38)     
CATEGORY       NOT NULL VARCHAR2(40)   
SUBCATEGORY             VARCHAR2(40)   
MOD_DT         NOT NULL DATE           

If you want the fields listed horizontally, try select * from myschema.mytable where rownum = 1 This will bring you back one row, with all the column names listed on one line, although they may be spaced out considerably. This way, you'd also have a row of sample data.

select * from myschema.category where rownum = 1;

CATEGORY_ID            CATEGORY                                 SUBCATEGORY                              MOD_DT                   
---------------------- ---------------------------------------- ---------------------------------------- -------------------------
28                     My Category                              My Subcategory                           18-MAR-14 13:41.27       
1

If you're a student and can't install SQL Developer locally, maybe you could use SQuirreL SQL, a more lightweight (but still excellent) JDBC database client. I've not used the graphical stuff which I believe they have, but you can just simply navigate the tree like structures through the tables and easily get any info you may want, table structure, row count and data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.