什么是高级?这就叫高级—openGauss(122)

20 阅读1分钟

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/

  • MULTISET EXCEPT [ALL | DISTINCT]

    参数:nesttable类型

    返回值:nesttable类型

    功能描述:两个集合变量的差集。如A MULTISET EXCEPT B:ALL表示去除A中与B重复的元素;DISTINCT表示先对A进行去重操作,然后去除与B中有重复的元素。

    示例:

    openGauss=# declare
    openGauss-#     type nest is table of int;
    openGauss-#     a nest := nest(1,2,2);
    openGauss-#     b nest := nest(2,3);
    openGauss-# begin
    openGauss$#     a := a MULTISET EXCEPT ALL b;
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {1,2}
    ANONYMOUS BLOCK EXECUTE
    
    openGauss=# declare
    openGauss-#     type nest is table of int;
    openGauss-#     a nest := nest(1,2,2);
    openGauss-#     b nest := nest(2,3);
    openGauss-# begin
    openGauss$#     a := a MULTISET EXCEPT DISTINCT b;
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {1}
    ANONYMOUS BLOCK EXECUTE
    

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/