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

PG 每日闯关题库(十九)

小鲁菜 2024-07-25
110

1、PostgreSQL中range类型不支持使用=或<>等操作符。 A
A、错误
B、正确

2、PostgreSQL中,以下哪个索引类型可以提高连续插入时的I/O平衡? C
A、BRIN索引
B、SP-GiST索引
C、反向键索引
D、Hash索引
答案解析:
反向键索引通过反转键值字节来平衡连续插入导致的索引热点。

3、PostgresSQL数据库中不能作为字段的数据类型是哪个? B
A、位串类型
B、伪类型
C、复合类型
D、数组类型

4、在PG数据库中,与oracle中select 1 from dual 语句等价的语句是下面哪一个?
A、select 1 from dual;
B、select 1;
C、select 1 from;
答案解析:
在PG数据库中没有与oracle对应的dual表,想要实现与oracle中dual表的功能只需要写从select 到from之前部分即可。例如:select 1+1;返回结果为2。

5、在PostgresSQL中,VACUUM和CREATE INDEX使用的内存是由哪个参数控制的? D
A、work_mem
B、temp_buffers
C、shared_buffers
D、maintenance_work_mem

6、使用CREATE DATABASE创建新数据库时指定字符编码ENCODING参数,请问需要指定哪个模板?C
A、template1
B、template0和template1均可以
C、template0
D、template0和template1均不可以
答案解析:
template1 默认使用 UTF8 编码,并且允许连接。
要使用不同的字符编码创建数据库,你应该使用 template0 作为模板数据库,并显式指定所需的字符编码。
CREATE DATABASE db1 ENCODING 'UTF8' TEMPLATE template0;
CREATE DATABASE db2 ENCODING 'UTF8' TEMPLATE template1;
create database db3 template template0 encoding 'sql_ascii';
create database db4 template template1 encoding 'sql_ascii';--会报错

ERROR: new encoding (SQL_ASCII) is incompatible with the encoding of the template database (UTF8)
HINT: Use the same encoding as in the template database, or use template0 as template.


8、在PostgresSQL中,请问SELECT操作时,是不是一定没有写磁盘的操作?B
A、是
B、不是


9、在pg数据库中,下面那个语句可以授予用户test对public这个schema下所有表的查询权限?D
A、grant insert on all tables in schema public to test;
B、grant delete on all tables in schema public to test;
C、grant update on all tables in schema public to test;
D、grant select on all tables in schema public to test;

答案解析:
grant select on all tables in schema public to test; 授予用户test对public这个schema下所有表的查询权限。
grant insert on all tables in schema public to test; 授予用户test对public这个schema下所有表的插入权限。
grant update on all tables in schema public to test; 授予用户test对public这个schema下所有表的更新权限。
grant delete on all tables in schema public to test; 授予用户test对public这个schema下所有表中数据的删除权限。

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

评论