mysql查看所有表的详细信息和注释(表、视图、函数等),简要查看表字段信息describe、show full columns。查看对象DDL语句、建表语句

1.总结

1.1.查看所有对象的详细信息和注释(表、视图、函数等)

-- 1.表、视图、字段的详细信息、注释说明
-- 1.1.表、视图
select * from information_schema.tables  where table_schema in ('test') order by table_schema,table_type,table_name;
select * from information_schema.views   where table_schema in ('test') order by table_schema,table_name;
-- 1.2.字段
select * from information_schema.columns where table_schema in ('test') order by table_schema,table_name,ordinal_position;
-- 2.表、视图的字段简要信息
-- 2.1.超级简要
describe student;
describe student_view;
-- 2.2.简要。比describe多点
show full columns from student;
show full columns from student_view;
-- 3.函数、存储过程
select * from information_schema.routines where routine_schema in ('test') order by routine_schema,routine_type,routine_name;

1.2.查看所有对象DDL定义语句(表、视图、函数等)

-- 1.2.查看所有对象DDL定义语句(表、视图、函数等)
show create table      student;
show create view       student_view;
show create function   get_stu_name;
show create procedure  my_procedure;
show create database   test;
show create tablespace ***;
show create user       root;

2.测试

  • 建表、视图、索引
drop table if exists student;
create table student
(
    s_id   int          default null comment '学生学号',
    s_name varchar(100) default null comment '学生姓名',
    key idx_s_name (s_name)
) comment ='学生';

-- 视图
create or replace view student_view as
select s_id, s_name
from student
order by s_id desc;

-- 函数
drop function if exists get_stu_name;
create function get_stu_name(p_s_id int)
    returns varchar(100)
begin
    return (select s_name from student where s_id = p_s_id);
end;

-- 存储过程
drop procedure if exists my_procedure;
create procedure my_procedure()
begin
    #routine body goes here...
end;

2.1.查看所有对象的详细信息和注释(表、视图、函数等)

2.1.1.表、视图、字段的详细信息和注释

-- 1.1.表、视图
select * from information_schema.tables  where table_schema in ('test') order by table_schema,table_type,table_name;
select * from information_schema.views   where table_schema in ('test') order by table_schema,table_name;
-- 1.2.字段
select * from information_schema.columns where table_schema in ('test') order by table_schema,table_name,ordinal_position;

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

2.1.2.表、视图的字段简要信息

-- 2.表、视图的字段简要信息
-- 2.1.超级简要
describe student;
describe student_view;
-- 2.2.简要。比describe多显示几个字段
show full columns from student;
show full columns from student_view;

在这里插入图片描述

在这里插入图片描述

2.1.3.函数、存储过程、触发器等

-- 3.函数、存储过程
select * from information_schema.routines where routine_schema in ('test') order by routine_schema,routine_type,routine_name;

在这里插入图片描述

2.1.4.查看所有对象DDL定义语句(表、视图、函数等)

-- 1.2.查看所有对象DDL定义语句(表、视图、函数等)
show create table      student;
show create view       student_view;
show create function   get_stu_name;
show create procedure  my_procedure;
show create database   test;
show create tablespace ***;
show create user       root;

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

相关链接

oracle查看所有对象(表、视图、索引、函数、存储过程等)的详细参数和注释。查看所有对象(表、视图、索引、函数、存储过程等)DDL定义语句

MySQL、Oracle 查看表占用空间大小

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

茅坑的小石头

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值