mysql의 desc의 결과 내용

Field      |       Type     |       Null     |     Key     |  ....
===================================
             |                    |                  |                |


---------------------------------------------------

select t1.table_name, t1.column_name, t1.data_type, t2.pk, t2.nval
from   (
          select table_name,column_name,sum(pk) pk,sum(nullvalue) nval
          from   (
                    select distinct t2.table_name,t1.column_name,
                        decode(t2.constraint_type,'P',1,0) pk,
                        decode(t2.constraint_type,'C',1,0) NUllvalue
                    from   user_cons_columns t1,user_constraints t2
                    where  t2.constraint_type in ('P','C')
            and    t2.constraint_name = t2.constraint_name
            and    t2.table_name = t1.table_name
            and    t1.owner = t2.owner
            and    t1.table_name = '해당테이블'
            --and    t2.owner = '테이블 유저'
            order by t2.table_name,t1.column_name
          )
          group by table_name,column_name
            ) t2,
            (
            select table_name, column_name, data_type
            from   user_tab_cols
            where  table_name = '해당테이블'
            ) t1
where  t1.column_name = t2.column_name(+)
and    t1.table_name = t2.table_name(+)
Posted by 아름프로
BLOG main image

카테고리

분류 전체보기 (539)
이야기방 (19)
토론/정보/사설 (16)
IBM Rational (9)
U-IT (0)
SOA/WS/ebXML (110)
개발방법론/모델링 (122)
J2SE (34)
J2EE (60)
DataBase (39)
Open Projects (30)
BP/표준화 (50)
Apache Projects (15)
Web/보안/OS (22)
Tools (7)
AJAX/WEB2.0 (1)
Linux/Unix (1)
영어 (0)
비공개방 (0)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

달력

«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

글 보관함

Total :
Today : Yesterday :