Is partial dependency possible In Data Base for Foreign key relationship I have 3 tables Student, Teacher &amp; User.

Student:

CREATE TABLE Student( id INT NOT NULL PRIMARY KEY,name VARCHAR(50) NOT NULL);
INSERT INTO [dbo].[Student]([id],[name]) VALUES(4,'Ram'),(5,'Raman');


Teacher:

CREATE TABLE Teacher( id INT NOT NULL PRIMARY KEY,name VARCHAR(50) NOT NULL);
INSERT INTO [dbo].[Student]([id],[name]) VALUES(1,'Raj'),(2,'Rahul');


User:

CREATE TABLE [dbo].[User](
    id INT NOT NULL PRIMARY KEY,
    user_id INT NOT NULL,
    user_type CHAR(1) NOT NULL,
    user_name VARCHAR(10) NOT NULL,
    user_password VARCHAR(255) NOT NULL,

    CONSTRAINT  FOREIGN KEY (user_id) REFERENCES Student (id),
    CONSTRAINT  FOREIGN KEY (user_id) REFERENCES Teacher (id) );


Now I try to INSERT in User table with below query 

INSERT INTO [dbo].[User] ([id] ,[user_id] ,[user_type], [user_name], [user_password])
VALUES  (1 ,1,'S','Raj_001','********')


It gives me error for violation of foreign key due to value of user_id is available in  Teacher and not in Student 

So my question is: How can I achieve that a value of user_id is  present in one of those tables and data should be inserted in User table.
Something I would be worried about with this approach is what will keep me from having a Student_id of 27 for Kevin, and a Teacher_ID of 27 for Mr. Jones? If you absolutely want to avoid this you could use a single base table for Person, then everyone get's their own number.

In keeping the current plan, I would pull the user_id field from the user table, and add a user_id field to the student and teacher tables. The student table would now have a foreign key to the Primary key of the user table, essentially going the opposite way you have it going here. Now a person's User_ID is part of their record.

CREATE TABLE Teacher( id INT NOT NULL PRIMARY KEY,name VARCHAR(50) NOT NULL, user_id INT NOT NULL);
INSERT INTO [dbo].[Student]([id],[name], [user_id]) VALUES(1,'Raj', 356),(2,'Rahul',222);

CREATE TABLE Student( id INT NOT NULL PRIMARY KEY,name VARCHAR(50) NOT NULL, user_id INT NOT NULL);
INSERT INTO [dbo].[Student]([id],[name], [user_id]) VALUES(4,'Ram',123),(5,'Raman',232);

CREATE TABLE User(User_ID INT NOT NULL PRIMARY KEY, User_Type(Char(1) NOT NULL, User_Name NVARCHAR(25) NOT NULL, User_Password NVARCHER(255) NOT NULL)


ALTER TABLE Student
ADD CONSTRAINT FK_Student FOREIGN KEY (User_ID) REFERENCES User (User_ID)
ALTER TABLE Teacher
ADD CONSTRAINT FK_Teacher FOREIGN KEY (User_ID) REFERENCES User (User_ID)