i have two tables userrooms and rooms. userrooms contain info about user and room id which he created. when the record for the user is created in this table rid1, rid2 and rid3 shoud be NULL, because usar havenot created any room. The user can create 3 rooms as soon as he creates any room this room is actually created in room table. any room created by user gets his unicue id from room tables rid collumn which is auto increment. this rid shoud be written in rid1 collumn in userrooms. room table there is actual room data. roomid room owner and room options. How can i make referentials between this two tables? CREATE TABLE `userrooms` ( `uid` int(6) UNSIGNED ZEROFILL NOT NULL COMMENT 'User ID', `rid1` int(6) UNSIGNED ZEROFILL NOT NULL COMMENT 'Room ID', `rid2` int(6) UNSIGNED ZEROFILL NOT NULL COMMENT 'Room ID', `rid3` int(6) UNSIGNED ZEROFILL NOT NULL COMMENT 'Room ID', PRIMARY KEY(`uid`), ) ENGINE=INNODB; CREATE TABLE `rooms` ( `rid` int(6) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT 'Room Number', `uid` int(6) NOT NULL COMMENT 'Room Owner ID', `opt` varchar(10) NOT NULL COMMENT 'Room Options', PRIMARY KEY(`rid`) ) ENGINE=INNODB COMMENT = 'Chat Rooms Data' CHARACTER SET latin1 ;