Sindhu Kavuri

Sindhu Kavuri

  • NA
  • 98
  • 11.8k

my foreign key is giving null values

Feb 24 2018 4:06 AM
 hii,
here i had referred ID as a foreign key which is the primary key of another table.
 
see i will show you my tables
 
   mood table.
 
CREATE TABLE tblmood(
moodid INT PRIMARY KEY IDENTITY(1,1) ,
mood VARCHAR(30) NOT NULL,
ID INT FOREIGN KEY REFERENCES signup(ID)
);
 
   Signup table
 
CREATE TABLE signup(
ID INT PRIMARY KEY IDENTITY(1,1) ,
username VARCHAR(30) NOT NULL,
email VARCHAR(30) NOT NULL,
passwd VARCHAR(30) NOT NULL,
);
 
so , whats the problem is in the mood table i am getting the null , instead the user id from the signup table
 
Someone show me the right direction .
Thanks in Advance 
 
 

Answers (9)