I have a IS-A relationship between actor and person.
I understand how to write an insertion statement for PERSON. But how would I connect that
to ACTOR?
EDIT: To clarify, is there a way to do this besides setting the relationship manually?
CREATE TABLE person
(
person_id INT,
person_name VARCHAR(20),
birth_year CHAR(4),
gender CHAR(1),
PRIMARY KEY(person_id)
);
CREATE TABLE actor
(
actor_id INT NOT NULL REFERENCES person(person_id),
PRIMARY KEY(actor_id)
);
That depends how you are determining who is an actor. If you already know this at the time of insertion into the person table, then you can just use another INSERT statement to insert the row into the actor table as well.
If you already have the person table defined and want to identify particular people and tag them as actors (i.e. by name), you could do something like:
http://sqlfiddle.com/#!2/ce898/9
Either way, as long as the actor_id in actor matches a valid person_id in person, the INSERT will be valid. If no corresponding person_id exists, the INSERT will fail.