云数据库 GaussDB-CREATE SCHEMA:示例

时间:2023-11-01 16:22:24

示例

 1 2 3 4 5 6 7 8 910111213
--创建一个角色role1。postgres=# CREATE ROLE role1 IDENTIFIED BY 'xxxxxxxxxxx';-- 为用户role1创建一个同名schema,子命令创建的表films和winners的拥有者为role1。postgres=# CREATE SCHEMA AUTHORIZATION role1     CREATE TABLE films (title text, release date, awards text[])           CREATE VIEW winners AS              SELECT title, release FROM films WHERE awards IS NOT NULL;--删除schema。postgres=# DROP SCHEMA role1 CASCADE;--删除用户。postgres=# DROP USER role1 CASCADE;
support.huaweicloud.com/devg-opengauss/opengauss_devg_0557.html