Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> tworzenie tabeli - pomożcie prosze, problem z tworzenie tabeli polączonych
grzechoo
post
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 5.01.2005

Ostrzeżenie: (0%)
-----


witam wszystkich, dopierozaczynam przygode z mysql
chce utworzyc tabele hasla polaczona z inna tabela klienci, ale wyskakuje mi blad
ERROR 1005:Can't create table.......<errno:m 150>
czy ktos wie co mam zle?? pomozcie prosze

create table hasla (login varchar(15) NOT NULL primary key,
haslo text NOT NULL,
CONSTRAINT warunek1 FOREIGN KEY (login) REFERENCES klienci(login) ) TYPE=InnoDB;
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
grzechoo
post
Post #2





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 5.01.2005

Ostrzeżenie: (0%)
-----


chce zrobic takie tabele i polaczenia miedzy nimi.
w sumie to juz je zrobilem jakbyscie mogli to sprawdzcie i nap[iszcie czy to sie nadaje, z gory dzieki
-----------------------------------------------------------
-----------------------------------------------------------
create table hasla (login varchar(15) NOT NULL,
haslo text NOT NULL,
PRIMARY KEY (login),
CONSTRAINT 1_1 FOREIGN KEY (login) REFERENCES kontrahenci (login));

___________________________________________
create table kontrahenci (
login varchar(15) NOT NULL,
idklienta int NOT NULL PRIMARY KEY AUTO_INCREMENT,
nazwa varchar(20) NOT NULL,
adres varchar(20) NOT NULL,
miasto varchar(20) NOT NULL,
kod_pocztowy int(5) NOT NULL default '0',
regon int NOT NULL default '00000',
kraj text,
CONSTRAINT 1_2 FOREIGN KEY (idklienta) REFERENCES zamowienie(idklienta));
------------------------------------------------------
create table zamowienie (
idzamowienia int NOT NULL PRIMARY KEY AUTO_INCREMENT,
idklienta int NOT NULL,
idtowaru int NOT NULL,
data_zamowienia date NOT NULL default '0',
sposob_platnosci enum('gotowka','czek','raty','odroczony_termin'),
idstatus int NOT NULL,
CONSTRAINT 1_2 FOREIGN KEY (idtowaru) REFERENCES towary(idtowaru));

------------------------------------------------------

create table status (
idstatus int NOT NULL PRIMARY KEY AUTO_INCREMENT,
nazwa enum('zrealizowane','realizowane','niezrealizowane','nieznane'),
CONSTRAINT 1_4 FOREIGN KEY (idstatus) REFERENCES zamowienie(idstatus));

------------------------------------------------------

create table opis_zamowienia (
idzamowienia int NOT NULL PRIMARY KEY,
idtowaru int NOT NULL,
cena int NOT NULL default '0',
ilosc int NOT NULL default'0',
rabat int NOT NULL default'0',
CONSTRAINT 1_5 FOREIGN KEY (idzamowienia) REFERENCES zamowienia(idzamowienia));
--------------------------------------------------

create table towary (
idtowaru int NOT NULL PRIMARY KEY AUTO_INCREMENT,
iddostawcy int NOT NULL,
nazwa varchar(20) NOT NULL,
cena int NOT NULL default '0',
ilosc int NOT NULL default'0',
data_przyjecia date NOT NULL default '0',
idrodzaj int NOT NULL,
CONSTRAINT 1_6 FOREIGN KEY (iddostawcy) REFERENCES dostawca(iddostawcy));

-----------------------------------------------------
create table dostawca (
iddostawcy int NOT NULL PRIMARY KEY AUTO_INCREMENT,
nazwa varchar(20) NOT NULL,
adres varchar(20) NOT NULL,
miasto varchar(20) NOT NULL,
kod_pocztowy int(5) NOT NULL default '0',
regon int NOT NULL default '00000',
kraj text,
);

---------------------------------------------------
create table kategoria (
idrodzaj int NOT NULL PRIMARY KEY AUTO_INCREMENT,
nazwa varchar(20) NOT NULL,

CONSTRAINT 1_6 FOREIGN KEY (idrodzaj) REFERENCES towary(idrodzaj));
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 19:20