Total PageViews

Monday, July 29, 2019

How to Add Comments on Table Level and Column Level in Oracle Database


Suppose we have a Table Emp in which we store the data of Employees and we want to add comments on the table and individual columns as well.
E.g:-


--------------------------------Dummy Table------------------------------------------
Create Table Emp
(Id Number(10),
Name Varchar2(100)
);
-------------------Add Comments on Table Level----------------------------------
COMMENT ON TABLE EMP  IS 'This table is used to store the name of the Employees';
--Check the comments for table level
select * from user_tab_comments where table_name='EMP';

-------------------Add Comments on Column Level---------------------------------
COMMENT ON COLUMN EMP.Id  IS 'This is the unique key of the Employees';
--Check the comments for column level
select * from user_col_comments where table_name='EMP';

No comments:

Post a Comment