zoukankan      html  css  js  c++  java
  • oracle 表 及字段相关的 统计分析

    --结构化数据-数据表

    with x as (
    select b.COMMENTS 表中文名,u.TABLE_NAME 表名称,b.COMMENTS 表详细描述,u.NUM_ROWS 数据量 from user_tables u left join user_tab_comments b on u.TABLE_NAME=b.TABLE_NAME
    )
    ,y as(
    SELECT SEGMENT_NAME TABLE_NAME,
    SUM(BYTES)/(1024*1024) "TABLE_SIZE[MB]"
    FROM USER_SEGMENTS
    WHERE SEGMENT_TYPE='TABLE'
    -- AND SEGMENT_NAME=x.TABLE_NAME
    GROUP BY SEGMENT_NAME)
    select x.*,y."TABLE_SIZE[MB]" 存储空间 from x left join y on x.表名称 = y.TABLE_NAME;

    --结构化数据----字段
    select tc.COMMENTS 表中文名,c.table_name 表名称,
    comm.comments 字段中文名称,
    c.column_name 字段名称, c.NUM_DISTINCT 非重复行数,
    t.num_rows - c.num_nulls as 非空数据总量
    from user_tab_columns c
    join user_tables t on c.TABLE_NAME = t.TABLE_NAME
    left join user_col_comments comm on comm.table_name = c.table_name and c.column_name = comm.column_name
    left join user_tab_comments tc on tc.table_name = t.table_name
    where c.table_name = 'table_name'
    order by c.column_name

  • 相关阅读:
    sshpass做秘钥分发,ansible做自动化运维工具
    Day7 面向对象和类的介绍
    R-aggregate()
    R-seq()
    R-ts()
    R-ets()
    python-无联网情况下安装skt-learn
    python-线性回归预测
    python-matplotlib-ERROR
    python-pyhs2
  • 原文地址:https://www.cnblogs.com/feiye512/p/12222830.html
Copyright © 2011-2022 走看看