daniel kessler wrote:
>
> OK, so just to be sure that I understand.  Here's a few tables below.  When I delete a poll, this'll delete the associated answeres automatically and because they're deleted, any results
> associated with those answers will also automatically be deleted - just be deleting a particular poll, right?

> create table fsnep_polls (
>     p_id NUMBER Primary Key,
>     p_date_added date,
>     p_date_last_used date,
>     p_question VARCHAR2(400),
>     p_status NUMBER
> )
>
> create table fsnep_pollAnswers (
>     pA_id NUMBER Primary Key,
>     pA_pollID NUMBER REFERENCES fsnep_polls(p_id) ON DELETE CASCADE,
>     pA_answer VARCHAR2(400)
> )
>
> create table fsnep_pollResults (
>     pV_id NUMBER Primary Key,
>     pV_date_added date,
>     pV_poll_id NUMBER REFERENCES fsnep_polls(p_id),
>     pV_poll_Answer NUMBER REFERENCES fsnep_pollAnswers(pA_id) ON DELETE CASCADE,
>     pV_ip VARCHAR2(20)
> )

Yes. Don't you love foreign keys ;-)

Jochem
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to