So I have found out that I need to do a specialization Hierarchies model, however I can't quite figure out how to code it. I have found some information on how to do generalization.
My question is: is it the same way to code it but different way to express it?
Let's take this as an example:
(source: javaguicodexample.com)
CREATE TABLE Employee(
EmpNo INTEGER,
EmpName VARCHAR(30),
EmpHireDate DATE,
CONSTRAINT PKEmployee PRIMARY KEY (EmpNo)
);
CREATE TABLE SalaryEmp(
EmpNo INTEGER,
EmpSalary DECIMAL(10,2),
CONSTRAINT PKSalaryEmp PRIMARY KEY (EmpNo),
CONSTRAINT FKSalaryEmp FOREIGN KEY (EmpNo) REFERENCES Employee ON DELETE CASCADE
);
CREATE TABLE HourlyEmp(
EmpNo INTEGER,
EmpRate DECIMAL(10,2),
CONSTRAINT PKHourlyEmp PRIMARY KEY (EmpNo),
CONSTRAINT FKHourlyEmp FOREIGN KEY (EmpNo) REFERENCES Employee ON DELETE CASCADE
);
is this how it should be coded? and the ERD should look like this one?