云数据库 GAUSSDB-CREATE SCHEMA:示例

时间:2024-11-02 18:53:03

示例

--创建一个角色role1。
openGauss=# CREATE ROLE role1 IDENTIFIED BY 'xxxxxxxxx';

-- 为用户role1创建一个同名schema,子命令创建的表films和winners的拥有者为role1。
openGauss=# 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。
openGauss=# DROP SCHEMA role1 CASCADE;
--删除用户。
openGauss=# DROP USER role1 CASCADE;
support.huaweicloud.com/centralized-devg-v2-gaussdb/devg_03_0570.html