3
Answers

sql database query

Kunal Gupta

Kunal Gupta

8y
287
1
Two tables are there
 
 
CREATE TABLE [dbo].[Status_Master_Table]
(
[StatusId] INT IDENTITY (1, 1) NOT NULL,

[Status_Description] NVARCHAR (50) NOT NULL,

[Remarks] VARCHAR (50) NOT NULL,

PRIMARY KEY CLUSTERED ([StatusId] ASC)
); 
 
second table is
 
CREATE TABLE [dbo].[Lab_Master_Table]
(
[Lab_Id] INT IDENTITY (1, 1) NOT NULL,

[Lab_Name] NVARCHAR (50) NOT NULL,
 
[Status] NVARCHAR (50) NOT NULL,

PRIMARY KEY CLUSTERED ([Lab_Id] ASC),

UNIQUE NONCLUSTERED ([Lab_Name] ASC)

); 
 
what is the syntax to set[StatusId] of first table as a foreign key to second table
 

Answers (3)