Views in Oracle
A view is a virtual table that is based on the result of a SQL query. Views are used to simplify complex queries and provide a simplified view of the data for end users. Here is an example:
CREATE VIEW emp_dept_view AS
SELECT e.first_name, e.last_name, d.department_name
FROM employees e
JOIN departments d ON e.department_id = d.department_id;
This creates a view named "emp_dept_view" that selects the "first_name", "last_name", and "department_name" columns from the "employees" and "departments" tables, joined on the "department_id" column.
No comments:
Post a Comment