1

有人可以说如何为雪花中的表格创建别名吗?

sample table:
CREATE OR REPLACE TABLE USER.EMPLOYEE(
    EMPNO CHAR(6 ) COLLATE 'en_US-upper-rtrim' NOT NULL,
    FIRSTNME VARCHAR(12 ) COLLATE 'en_US-upper-rtrim' NOT NULL,
    MIDINIT CHAR(1 ) COLLATE 'en_US-upper-rtrim' NULL,
    LASTNAME VARCHAR(15 ) COLLATE 'en_US-upper-rtrim' NOT NULL,
    WORKDEPT CHAR(3 ) COLLATE 'en_US-upper-rtrim' NULL,
    PHONENO CHAR(4 ) COLLATE 'en_US-upper-rtrim' NULL,
    HIREDATE DATE NULL,
    JOB CHAR(8 ) COLLATE 'en_US-upper-rtrim' NULL,
    EDLEVEL SMALLINT NOT NULL,
    SEX CHAR(1 ) COLLATE 'en_US-upper-rtrim' NULL,
    BIRTHDATE DATE NULL,
    SALARY NUMBER(9,2) NULL,
    BONUS NUMBER(9,2) NULL,
    COMM NUMBER(9,2) NULL
);

别名:

CREATE ALIAS "USER"."EMP" FOR TABLE "USER"." EMPLOYEE"
4

1 回答 1

0

如果您正在搜索SYNONYM/ALIAS,则 Snowflake 不支持它们。

CREATE SYNONYM EMP FOR USER.EMPLOYEE;

参考:将 Oracle 数据库迁移到 Snowflake:参考手册 - 附录 D


根据要求,可以使用 VIEW 代替:

CREATE VIEW USER.EMP
AS
SELECT *
FROM  USER.EMPLOYEE;
于 2021-08-21T13:56:27.873 回答