• Ogłoszenie:

Why is storestateid column returning null?

Wszystko odnośnie tworzenia grafiki - obróbka, problemy, oceny.
Tworzenia Stron internetowych - HTML, PHP, MySQL...

Why is storestateid column returning null?

Postprzez JulianAyers 04 Maj 2023, 06:01

reklama
I have created two tables: State and Store. The primary key for the State table is StoreStateID, which is an auto-incremented integer. The primary key for the Store table is StoreID, and it requires a foreign key that references StoreStateID. Even though I can successfully create the tables and import the data, I am having issues with the StoreStateID column, which always returns NULL. I'm not sure why the table is failing to reference the State table. Below is the code that I used to create the tables:

State Table:

sql
CREATE TABLE State (
StoreStateID INT NOT NULL AUTO_INCREMENT,
StateVPofSales VARCHAR(30),
PRIMARY KEY (StoreStateID)
);
Store Table:

sql
CREATE TABLE Store (
StoreID INT NOT NULL AUTO_INCREMENT,
StoreStateID INT NOT NULL,
PRIMARY KEY (StoreID),
FOREIGN KEY (StoreStateID) REFERENCES State(StoreStateID)
);
I would appreciate any insights koows developerbook echat into why this issue is occurring.
JulianAyers
~user
 
Posty: 6
Dołączenie: 11 Kwi 2023, 14:58



Powróć do Grafika & Webmastering

Kto jest na forum

Użytkownicy przeglądający to forum: Brak zarejestrowanych użytkowników oraz 4 gości