惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
T
Tenable Blog
博客园_首页
S
Securelist
Spread Privacy
Spread Privacy
Google Online Security Blog
Google Online Security Blog
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
U
Unit 42
L
LINUX DO - 热门话题
量子位
T
Threat Research - Cisco Blogs
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
Martin Fowler
Martin Fowler
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Security Latest
Security Latest
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
V2EX - 技术
V2EX - 技术
T
Tailwind CSS Blog
月光博客
月光博客
Recent Announcements
Recent Announcements
G
Google Developers Blog
F
Full Disclosure
W
WeLiveSecurity
宝玉的分享
宝玉的分享
腾讯CDC
G
GRAHAM CLULEY
Vercel News
Vercel News
Simon Willison's Weblog
Simon Willison's Weblog
美团技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security

博客园 - 轻舟软件

轻舟分公司协作平台:统一管理、高效协作 [ERR] 1118 - Row size too large (> 8126) IDEA中Java代码修改后及时生效的方法 python SQLite 访问组件 AI课堂笔记:AI编程 轻舟项目管理系统:台账・文件・协作・管控,让项目告别混乱,有序可控! 分公司项目的柔性管理(造价咨询、招标代理) 咨询行业——项目费用管控 咨询行业——项目管理模型 Java8:函数式接口、Lambda、Stream Java知识图谱(转) 简约至上 软件需求分析方法论(转) EasyUI的属性、事件、方法的使用 两位小数偶感 什么是函数? HQL分页查询、分组查询 马云卸任演讲全文(2019-09-10) MySQL权限管理常用命令
MySql 、Oracle 获取表结构和字段信息
轻舟软件 · 2019-09-26 · via 博客园 - 轻舟软件

1、MySql获取表结构信息

SELECT
    TABLE_NAME,
    TABLE_COMMENT
FROM
    information_schema.`TABLES`
WHERE
    TABLE_SCHEMA = 'dm' -- dm 是数据库名称,需替换
ORDER BY
    TABLE_NAME;

2、MySql获取字段信息

SELECT
    TABLE_NAME AS 'tableName',
    COLUMN_NAME AS 'columnName',
    COLUMN_COMMENT AS 'columnComment',
    IS_NULLABLE AS 'nullable',
    DATA_TYPE AS 'dataType',
    CHARACTER_MAXIMUM_LENGTH AS 'strLength',
    NUMERIC_PRECISION AS 'numLength',
    NUMERIC_SCALE AS 'numBit'
FROM
    information_schema.`COLUMNS`
WHERE
    TABLE_SCHEMA = 'dm' -- dm 是数据库名称,需替换
AND TABLE_NAME = 'base_auth_resource' -- base_auth_resource 是表名,需替换
ORDER BY
    TABLE_NAME,
    ORDINAL_POSITION;

3、Oracle获取表结构信息

select t.table_name, c.COMMENTS
  from user_tables t, user_tab_comments c
 where t.TABLE_NAME = c.TABLE_NAME
 order by t.table_name

4、Oracle获取字段信息

select t.TABLE_NAME     AS tableName,
       t.COLUMN_NAME    AS columnName,
       c.COMMENTS       AS columnComment,
       t.NULLABLE       AS nullable,
       t.DATA_TYPE      AS dataType,
       t.CHAR_LENGTH    AS strLength,
       t.DATA_PRECISION AS numLength,
       t.DATA_SCALE     AS numBit
  from user_tab_columns t, user_col_comments c
 where t.TABLE_NAME = c.TABLE_NAME
   and t.COLUMN_NAME = c.COLUMN_NAME
   and t.TABLE_NAME = 'EMP' -- EMP 是表名,需替换
 order by t.TABLE_NAME, t.COLUMN_ID

注: 以上 sql 均为实际可运行代码,请注意将相关的“数据库名”或“表名”进行替换。