Storing whether a user is a student or teacher? Is a lookup table necessary?
Your sample data suggests a User can be a Principal, so 0 and 1 won't work.  IF a User can only be 'a student' OR 'a teacher' OR 'a Principal' OR (a Janitor, a Librarian, etc.), this looks like a simple enumeration pattern and your second example would be the best approach.  Make sure your User table has a foreign key defined that points to the Role table to ensure that only valid Roles are used

Create Table dbo.Role (ID INT, RoleName varchar(30)
CONSTRAINT [PK_Role] PRIMARY KEY ([Id]))
Insert into dbo.Role (ID,RoleName) 
values(1,'Student'),(2,'Teacher'),(3,'Principal')

Create Table [User] (ID INT, UserName varchar(30), [Role] int
CONSTRAINT [PK_User] PRIMARY KEY ([Id])
CONSTRAINT [FK_User_Role] FOREIGN KEY ([Role]) REFERENCES [Role] ([Id])
)

--Works
Insert into dbo.[User] (ID,UserName,Role) values(1,'John',1),(2,'Teacher',2)

--Fails due to Role type 4 not in Role enum table
Insert into dbo.[User] (ID,UserName,Role) values(3,'Sam',4)