flavio@gral.org.br writes:
> CREATE TABLE Employee (
> Name VARCHAR(20),
> Salary NUMERIC(6,2)
> );
> CREATE TABLE Programmer (
> Language VARCHAR(12),
> Project VARCHAR(30)
> )INHERITS (Employee);
> CREATE TABLE Representative (
> Region VARCHAR(30)
> ) INHERITS (Employee);
>
> CREATE TABLE employees AS SELECT * FROM Employee;
> CREATE TABLE programmers AS SELECT * FROM Programmer;
> CREATE TABLE representatives AS SELECT * FROM Representative;
>
> INSERT INTO employees VALUES ('Sylvia Karsen', 3000.00);
> INSERT INTO programmers VALUES ('William Helprin', 400.00, 'C++', 'Seestorm');
> INSERT INTO representatives VALUES ('Akiko Yokomoto', 500.00, 'Asia');
>
> ORACLE Query Output
> SELECT e.Name FROM employees e;
This is the wrong handling of it. You're inheriting from the wrong
tables. There was no need to have pairs of tables for this.
CREATE TABLE Employees (
Name VARCHAR(20),
Salary NUMERIC(6,2)
);
CREATE TABLE Programmers (
Language VARCHAR(12),
Project VARCHAR(30)
)INHERITS (Employees);
CREATE TABLE Representatives (
Region VARCHAR(30)
) INHERITS (Employees);
INSERT INTO employees VALUES ('Sylvia Karsen', 3000.00);
INSERT INTO programmers VALUES ('William Helprin', 400.00, 'C++', 'Seestorm');
INSERT INTO representatives VALUES ('Akiko Yokomoto', 500.00, 'Asia');
select * from employees;
That has the expected output...
/* cbbrowne@[local]/dba2 tqual_test=*/ select * from employees;
name | salary
-----------------+---------
Sylvia Karsen | 3000.00
William Helprin | 400.00
Akiko Yokomoto | 500.00
(3 rows)
--
select 'cbbrowne' || '@' || 'acm.org';
http://cbbrowne.com/info/spiritual.html
"Markets can remain irrational longer than you can remain solvent."
-- J. M. Keynes