暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

openGauss每日一练第 15 天-实训作业

原创 Carton 2022-12-08
163

本文为第二届openGauss每日一练,21天打卡计划第 15 天的作业部分,课程内容总结如下openGauss每日一练第 15 天-学习查看表的相关信息

作业1

创建表和约束

create table test( id integer primary key, name varchar(20) not null, age integer default 18);

image.png

作业2

使用\d tableNmae命令查看表的定义、模式和所有者

\d+ test \dt+ test

image.png

作业3

查看某个模式下有哪些表

select table_name from information_schema.tables where table_schema = 'test';

image.png

作业4

查看一个表下有哪些约束

select conname, contype, conkey connamespace from pg_constraint where conrelid in( select oid from pg_class where relname = 'test');

image.png

作业5

查看一个表属于数据库的哪个模式

\x --将展示方式变成竖的 select * from information_schema.tables where table_name = 'test';

image.png

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论