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

33 阅读1分钟

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

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

  • MULTISET INTERSECT [ALL | DISTINCT]

    参数:nesttable类型

    返回值:nesttable类型

    功能描述:两个集合变量的交集。如 A MULTISET INTERSECT 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,2,3);
    openGauss-# begin
    openGauss$#     a := a MULTISET INTERSECT ALL b;
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {2,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,2,3);
    openGauss-# begin
    openGauss$#     a := a MULTISET INTERSECT DISTINCT b;
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {2}
    ANONYMOUS BLOCK EXECUTE
    

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

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