INSERT FOLLOW WITH OTHER INSERT

From: Johny Jugianto <johny(dot)q(at)rocketmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: INSERT FOLLOW WITH OTHER INSERT
Date: 2001-08-10 03:43:16
Message-ID: 20010810034316.2823.qmail@web14603.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc pgsql-sql

hi all

i have a table like this

CREATE SEQUENCE seq_student_id INCREMENT 1 START 1;
CREATE TABLE students (
student_id INT4 NOT NULL DEFAULT
NEXTVAL('seq_student_id'),
student_name text,
student_address text,
primary key(student_id)
)
CREATE TABLE student_club (
student_id INT4 NOT NULL;
club_id INT4,
CONSTRAINT student_id_update FOREIGN KEY(student_id)
REFERENCES students(student_id) ON UPDATE CASCADE
)

my question is how i can make auto insert student_id
on table student_club when i insert into table
students

example:
INSERT INTO students(student_name) VALUES('Willy');

table STUDENT
student_id | name | address
---------------------------------
1 | Willy |

and on TABLE student_club
student_id | club_id
--------------------
1 |

i have trying with create rule and with
check_foreign_key, but i haven't found solution.
anyone can help me?

Thanks in advance

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Ketil Malde 2001-08-10 08:03:49 case sensitivity in column names
Previous Message Hiroshi Inoue 2001-08-10 03:19:03 Re: ODBC 7.1

Browse pgsql-sql by date

  From Date Subject
Next Message Bhuvan A 2001-08-10 11:17:18 Re: INSERT FOLLOW WITH OTHER INSERT
Previous Message Hiroshi Inoue 2001-08-10 03:19:03 Re: ODBC 7.1