SQL 复杂的观点
示例
视图可能非常复杂query(aggregations,joins,subqueries,etc)。只需确保为选择的所有内容添加列名即可:
Create VIEW dept_income AS SELECTd.Nameas DepartmentName, sum(e.salary) as TotalSalary FROM Employees e JOIN Departments d one.DepartmentId= d.id GROUP BY d.Name;
现在,您可以从任何表格中进行选择:
SELECT * FROM dept_income;