如何检索或阅读 SQL 中特定列的评论

How to retrieve or read comments of particular column in SQL

我已经为专栏添加了一些评论

 COMMENT ON COLUMN STUDENT.STUDENT_NAME
 IS 'This is comment for the column';

 COMMENT on column student.student_name 'THIS IS COMMENT FOR THE COLUMN' succeeded.

如何使用查询查看它?

你试过这个吗:

select * from user_tab_comments where table_name='STUDENT'

或者这个:

select * from all_tab_comments where table_name='STUDENT'

推测您正在使用 ORACLE RDBMS。在这种情况下,您可以使用 user_col_comments 系统视图:

SELECT comments
FROM user_col_comments
WHERE TABLE_NAME = 'STUDENT' AND COLUMN_NAME = 'STUDENT_NAME'

SQL Fiddle Demo