Re: re:database tables relations advice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is solved by using FOREIGN KEY but I'm not sure if MySQL have them present or just planned for some future release.

mrfroasty napsal(a):
I am quite new to database designs, I have a problem in my design...I
can actually feel it, but I am not quite sure if there is a feature in
mysql or I have to solve it with programming.

Example:
CREATE TABLE A (
                user_id int(16) NOT NULL auto_increment,
                ..........other datas
                PRIMARY KEY (user_id)
               );

CREATE TABLE B (
                user_id int(16) NOT NULL auto_increment,
                ..............other datas
                PRIMARY KEY (contact_id)
            );

Question:
How can I declare that the user_id in my 1st table is related to user_id
in the 2nd table...actually I prefer to have it exactly the same user_id
in both tables....I think if those 2 entries are the same it will be
great, but I am not sure how to achieve this.

P:S
-Ofcourse I know that I can extract it from TABLE A and save it in TABLE
B....but is that a way to go???Because this issue arise in couple of
tables in my data structure that I am tending to use in my application(web).
-I also know that its possible to  make just 1 big table with lots of
columns....but I read its not a good database design...

----->>>>>please advice, running out of ideas :-(

Thanks......



--

S pozdravem

Daniel Tlach
Freelance webdeveloper

Email: mail@xxxxxxxxxxxx
ICQ: 160914875
MSN: danaketh@xxxxxxxxxxx
Jabber: danaketh@xxxxxxxxx


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux