I'm new to SQL and database design.
I have a task where I need to create a table with users (student or teacher), each user can be in a group or more, and each group can get one or more tasks to solve.
I created the design, but I think is a problem with the entity
Is this a possible way to do it?
insert into [group] (group_id) values((SELECT ISNULL(MAX([group_id])+1,1) FROM [group] WITH(SERIALIZABLE, UPDLOCK))) insert into [Entity3] values(1,1) //values(x,y) x - user_id, y - group_id where I want to add the user insert into [Entity3] values(2,1) insert into [Entity3] values(3,1)
This is working as expected, but maybe something shorter or easier?