---
title: "查询表的字段属性"
author: "-+lizzy+-"
date: "2009-12-15T23:57:31Z"
tags: []
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2009-12-15T23:57:31Z"
id: 549313
url: "https://iamelisa.iteye.com/blog/549313"
---

查询表的字段名称，类型，长度，是否为空，备注

select  
col.table\_name,  
col.column\_id,  
col.column\_name,  
col.data\_type,  
col.data\_length,  
col.nullable,  
comm.comments  
from user\_tab\_cols col  
LEFT JOIN user\_col\_comments comm  
on col.table\_name = comm.table\_name  
and col.column\_name = comm.column\_name  
where col.table\_name = 'TEST'  
;