Post
#1
|
|
|
Grupa: Zarejestrowani Postów: 48 Pomógł: 0 Dołączył: 27.07.2008 Ostrzeżenie: (0%)
|
Mam taki problem. Chcialbym stworzyć proste relacje pomiędzy tabelami. Mam kod:
CODE create table users ( id int auto_increment primary key, login varchar(255), passwd varchar(255) ) type= INNODB; create table filmy ( id int auto_increment primary key, tytul varchar(255) ) type= INNODB; create table dozwolone ( user_id int , film_id int, foreign key(user_id) references user(id), foreign key(film_id) references filmy(id) ) type= INNODB; Chciałbym zrobić relacje tego typu, że w tabelidozwolone miałbym id użytkownika i nr filmu który może oglądać. Po usunięciu użytkownika z tabeli dozwolone zostałoby usunięte wszystkie id tego uzytkownika. Prosta ilustracja: (IMG:http://kaczanowski.cp5.win.pl/schemat.gif) |
|
|
|
kangur91 Proste relacje 3.12.2008, 21:02:46
c3zi Możesz po prostu dodać on delete cascade lub po st... 3.12.2008, 21:52:43 ![]() ![]() |
|
Aktualny czas: 23.12.2025 - 10:31 |