Logical View Examples |
This example illustrates a situation where none of the tables have a complete primary key in the outlist of a query: SELECT d.name, e.name FROM Department d, Employee e WHERE d.id = e.dept_id This example illustrates a situation where exactly one of the tables has a complete primary key in the outlist of a query: SELECT e.id, e.dept_id, e.name, d.name, FROM Department d, Employee e WHERE d.id = e.dept_id This example illustrates a situation where more than one of the tables has its complete primary key in the outlist of a query (extra 1-to-1 relationship between 'employee' and 'computer'. Delete rule: cascading): SELECT e.id, e.dept_id, c.id, c.type, c.owner_id, d.name FROM Department d, Employee e, Computer c WHERE d.id = e.dept_id AND c.owner_id = e.id If you now insert a new record, a new employee and a new computer record should be created. When deleting a record, both records should be deleted. |