user1794106 user1794106 - 1 year ago 91
SQL Question

Add description to table metadata

What's the best way to add a table description to a table in the metadata? Also, what about for each specific table as well? This is for an oracle Database.

When we use spy-schema to generate a schema I want to be able to show a description for each table and also a description of its columns.

Answer Source

Never-mind, I found my own answer:

  • Create a comment on a table

    comment on table x is 'This is table x';

  • Create a comment on a column:

    comment on column t.x is 'This is column X of table T';

to view these comments:

  • View Column comments

    select * from user_col_comments where table_name = 'x';

  • View Table comment

    select * from user_tab_comments where table_name = 'x';

Hopefully this helps someone else..

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download