Oracle指定"you must specify aliases if the view definition includes constraints." 但是在下面的查询中,列电子邮件有一个唯一的约束,但没有别名。这样可以正常工作。为什么?
CREATE VIEW emp_sal (emp_id, last_name,
email UNIQUE RELY DISABLE NOVALIDATE,
CONSTRAINT id_pk PRIMARY KEY (emp_id) RELY DISABLE NOVALIDATE)
AS SELECT employee_id, last_name, email FROM employees;
答案 0 :(得分:0)
有趣的是,视图定义中有别名:
CREATE VIEW emp_sal (emp_id, last_name,
email UNIQUE RELY DISABLE NOVALIDATE,
CONSTRAINT id_pk PRIMARY KEY (emp_id) RELY DISABLE NOVALIDATE)
AS SELECT employee_id, last_name, email FROM employees;
这里emp_id, last_name, email
只是别名。