Hello,
I am new to SQL and I am working on a class project,
But I just cant seem to fix this one problem and I have deleted and rebuilt this data base about a hundred times.
I fixed everything else that was bugging me but this I cant fix.
Ok, so here are the two tables I have written:
However If I run lets say:
I see all the data but the Foreign Key shows up as NULL
Were as if I do :
It shows the correct Keys.
Any tips, advise or suggestion please.
Thanks,
I am new to SQL and I am working on a class project,
But I just cant seem to fix this one problem and I have deleted and rebuilt this data base about a hundred times.
I fixed everything else that was bugging me but this I cant fix.
Ok, so here are the two tables I have written:
Code:
CREATE TABLE Employee
(
EmpID int IDENTITY(1,1) NOT NULL PRIMARY KEY,
LastName NVARCHAR (30) NOT NULL,
FirstName NVARCHAR (30) NOT NULL,
Address VARCHAR (80) NOT NULL,
City VARCHAR (40) NOT NULL,
State VARCHAR (2) NOT NULL,
AreaCode CHAR (3) NOT NULL,
Telephone VARCHAR (8) NOT NULL,
EEO1Class NVARCHAR (25) NOT NULL,
HireDate DATE NOT NULL,
Salary money NOT NULL,
Gender VARCHAR (1) NOT NULL,
Age int NOT NULL,
JobID int FOREIGN KEY REFERENCES JobTitle(JobID)
)
CREATE TABLE JobTitle
(
JobID int IDENTITY(500,10) NOT NULL PRIMARY KEY,
EEO1Class NVARCHAR (25) NOT NULL,
JobTitle NVARCHAR (50) NOT NULL,
JobDescrp NVARCHAR (255) NOT NULL,
Status CHAR (25)
)
Code:
SELECT *
FROM Employee
Were as if I do :
Code:
SELECT *
FROM JobTitle
Any tips, advise or suggestion please.
Thanks,