tags:

views:

130

answers:

1

How to create a view with the name "changedata" to see the full name of all employees, salary, department name and the name of the region and allows edit of data from the table s_emp view?

create view change as 
SELECT a.last_name||','||a.first_name as "Nombre", 
       a.salary as "Salary", b.name"Department", 
       c.name as "Region Name"
FROM s_emp a, s_dept b, s_region c
WHERE a.dept_id = b.id AND b.region_id = c.id
A: 

Two options.

  1. Include all the columns you want to be made editable, and make sure the view is updateable (I think in this case you'd at least need unique constraints on s_dept.id and s_region.id). Note that this will still not allow derived data to be edited (e.g. your "Nombre", "Department" and "Region Name" columns will not be editable).

  2. Create INSTEAD OF triggers to handle inserts, updates and/or deletes on the view.

Jeffrey Kemp
Sorry, this answer is specific to Oracle.
Jeffrey Kemp