我想创建一个视图,列出特定department_id的department_id,department_name,department_employees,total_dept_salary
答案 0 :(得分:0)
CREATE OR REPLACE VIEW theview AS
select department department_id,department_name,department_employees,total_dept_salary
from table1 join table2 using (department_id);
这假设加入两个表的是部门ID。如果表没有公共列,请改用ON子句。在任何一种情况下,了解每个表包含哪些列会很有帮助。
Als,check this out了解有关创建视图语法的更多信息。